all groups > sql server programming > may 2007 > threads for wednesday may 30
Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Optimization of query
Posted by aap31374 NO[at]SPAM gmail.com at 5/30/2007 11:20:52 PM
Hello !
I am using this query, my tables contains more then 900000 rows, and i
am getting result very slow. pl. help to optimize it .
GetDocumentsOfIndex is function whcih will return table.
select distinct document_id, cached_folder_id from rep_document where
document_id in ((select docu... more >>
TimeZone Information after Serialization
Posted by Sugandh Jain at 5/30/2007 10:00:07 PM
Hi,
I am serializing a collection of objects of a Type(Class).
The class contians a DateTime type property in it.
Now, I am serializing this collection.
For some of the DateTime values, I get the DateTime with the TimeZone
Information included in the XML.
Like this ... 2007-05-30T16:12... more >>
Connecting to a remote server with SQL Management Studio Express
Posted by Andrew Chalk at 5/30/2007 9:53:26 PM
I installed a copy of SQL 2005 Express on another computer here using the
automatic download and install from Microsoft supported by the setup
toolkit.
I can't access this server from another machine on the LAN using SQL
Management Studio Express. I can 'see' the server but cannot connect. ... more >>
SQL 2005 Linked Servers
Posted by Mike Labosh at 5/30/2007 7:29:53 PM
Can I just say,
SELECT *
FROM ServerA.DatabaseA.SchemaA.TableA
UNION
SELECT *
FROM ServerB.DatabaseB.SchemaB.TableB
Without explicitly creating a "linked server" ?
--
Peace & happy computing,
Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"Escriba coda ergo sum." -- vbSensei
... more >>
Read-Only Join
Posted by scott at 5/30/2007 6:56:06 PM
I'm trying to create a sql statement to use as a recordset on an Access data
form. I have 2 tables called "users" & "accounts". The "users" table on
contains an id field, first name and last name field. Any "user" record may
have many records in the "accounts" table. They are joined by the "us... more >>
where's the ( IF ) in sql server 2000
Posted by New Bee at 5/30/2007 3:54:16 PM
Hi there,
Im writing a query in which I wan to calculate a colum based on the values
of other columns, so what I wanted to do was something like
IF colType=3 then colRecovery * .234 ELSE colReverb * 0.6
How can I do this ??
Cheers
... more >>
delimited list within select
Posted by Terri at 5/30/2007 3:39:32 PM
I can't do this client side as my "client" is excel
Desire result is three fields returned
1,8,A;B
2,30,B;C;D
CREATE TABLE #Orders
(
Order_ID int
)
CREATE TABLE #OrderAccounts
(
Order_ID int,
Account char(1),
Amount int
)
INSERT INTO #Orders (Order_ID) VALUES (1)
INSERT INTO... more >>
Indexed views driving me batty ...
Posted by SQL Practitioner at 5/30/2007 3:19:32 PM
I have an indexed view iv_cm. And I have a query like this:
select *
from iv_cm with(noexpand)
where iv_cm.col_a = 12345
The optimizer does the right thing for this query. It does an "index
seek" on iv_cm using the index on col_a.
But if there is any other constraint on any other column ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Restore of a Database
Posted by Gary Johnson at 5/30/2007 2:55:08 PM
When using the SQL Server Management Studio to restore a database from a
device (filename.bak, for example), the options page shows the logical name
and the fully qualified file name for each of the database files. Does
anyone know how I might determine that type of information from a backup ... more >>
Help with SQL Query
Posted by Dan Shepherd at 5/30/2007 2:11:02 PM
I am trying to summarize data based on a period range in related tables.
Table one has a column that includes a date/time field. Table two has an
array field (MTD_1 to MTD_12) that has values I want to summarize based on
the date field in table one.
Example... Chekdate is 03/15/2007 in ta... more >>
Drop and Create view 2005
Posted by David C at 5/30/2007 1:36:59 PM
In SQL 2000 I could create one script that both dropped (if existed) and
created a view. Does SQL 2005 have anything like it anywhere. I can only
find separate DROP and CREATE scripting. Thanks.
David
... more >>
Users and Groups problem.
Posted by Alex at 5/30/2007 1:22:28 PM
OK, I can't think of a good way to do this so I'm hoping someone else
has some ideas:
My boss and I are trying to create a help desk system for our
customers. Boss decided that instead of only assigning tickets to one
particular tech, he wants to be able to assign techs to groups and
assign ... more >>
For XML Path/ WITH XMLNAMESPACES
Posted by MicroMite at 5/30/2007 11:29:02 AM
Is it possible to create generate xsi:schemaLocation="http://
http://.../name.xsd" while using the for XML Path syntax? I am able to define
everthing else except that (see example) below. Any help would be greatly
appreciated...Thanks
Example:
<Example xmlns:xsi="http://..." xsi:schemaLoca... more >>
how to grab decimal portion of the amount?
Posted by Mehbs at 5/30/2007 11:26:42 AM
I have to update the prices in SQL2K.
if the price is 201.10, decimal ends with 0, I need to add 1 so it is
201.11.
How to select the record with amount's decimal ending with 0?
Thanks
... more >>
8152 Error
Posted by Loren Z at 5/30/2007 10:58:14 AM
This is concerning a problem on an application database on SQL Server 2005
SP2 (Build 3159)
If I run the following command everything works fine.
BEGIN TRAN
UPDATE Table9 SET Remarks = 'Test'
WHERE Id =1
ROLLBACK TRAN
but if I change the above command to
BEGIN TRAN
UPDATE T... more >>
Anyone knows of a good free Data Generator for test databases?
Posted by shlomoid at 5/30/2007 9:34:12 AM
Hi,
I'm looking for a simple and freeware data generator application. I've
googled for an hour, and couldn't find something reasonable that is
also free.
Do you guys have some recommendations for something like this? Which
tools do you use?
Thanks,
Shlomo
... more >>
Help getting output from sproc to avoid DTC problem
Posted by Curtis at 5/30/2007 8:58:49 AM
I have a stored procedure that returns a value from a linked server. I
am unable to enable remote DTC access on that server. The sproc
returns the correct value, but when I try to insert that value in to a
table, I receive the "unable to begin a distributed transaction"
message (Msg 7391). I'm t... more >>
Allow Updates
Posted by CLM at 5/30/2007 8:55:02 AM
I got these msgs on one of my servers (SS 2000 SP4). It looks like someone
was playing around with this which is rather chilling. Is there any
legitimate reason for this? What I mean by that is that I know that clicking
on Enterprise Manager or running the Copy Database Wizard will sometim... more >>
Challenge-1 text column to many columns
Posted by Stephanie at 5/30/2007 8:49:00 AM
Okay, brainiacs, I need some help. I have a field in a database that is
defined as text and contains some characters and some bars (|). The bar
separates the values in the field into columns. For example,
5235D4793912C9O|120543||385
would mean 4 columns equal to:
A: 5235D4793912C9O
... more >>
SQL For Xml - Master Detail Nesting
Posted by Anastasiosyal at 5/30/2007 8:42:01 AM
Hello,
I will step right into this with an example. Let's assume we have the
following tables:
CREATE TABLE #ProductType(
ProductTypeId int Primary key,
ProductTypeDescription varchar(50)
)
Insert Into #ProductType Values (1, 'Gizmos')
Insert Into #ProductType Values (2, 'Gadgets')
... more >>
comparing dates
Posted by ITDUDE27 at 5/30/2007 8:07:00 AM
Hello world,
I have a table i'm trying to get the number of days difference using the
DATEDIFF() funciton.
I was wondering if I can use something other than MIN or MAX function to get
the datediff from the Next MIN date. (i.e. 2006-08-15 )
table_b
order_no rel_no rel_date
1150 ... more >>
Space is not released after you delete some rows from a table in S
Posted by Shyam at 5/30/2007 6:54:00 AM
Hi,
I delete some rows from a table in Microsoft SQL Server 2000, and the result
of the sp_spaceused stored procedure shows that lots of space in the table is
not released.
I went thru the Article ID:934378 related to Space is not released after you
delete some rows from a table in S2K and... more >>
Return table from Stored Procedure into another stored procedure
Posted by R C at 5/30/2007 5:58:00 AM
hi,
can this be done?
i have stored procedure 1 that calls stored procedure 2 in the FROM clause.
Stored procedure 2 is supposed to return a table.
For example:
select a, b, c
from
table1 ,
(exec storedproc2) table2
where
a = b and.....
please advise... more >>
Usage of 'set xact_abort on'
Posted by Mohans at 5/30/2007 5:56:01 AM
Hi,
One of my procedure is extracting data from flat files and insert that
records into 4 tables. Two of them in same DB and rest of that tables in some
other server(using linked server we are inserting into these table).
This procedure has 'set xact_abort on' in two places one of that in... more >>
PRoblem with sub query
Posted by satish at 5/30/2007 4:12:26 AM
HI ,
I have two tables
create table locations (loc_id int primary key,location_code char(20))
sample data
insert into locations values (1,'xxx')
insert into locations values(2,'yyy')
insert into locations values(3,'zzz')
insert into locations values(4,'www')
select * from locations
Tabl... more >>
What am I doing wrong when I execute a SROC (using Output parameters) from within another?
Posted by mark4asp at 5/30/2007 3:56:21 AM
What am I doing wrong when I execute a SROC (using Output parameters)
from within another?
The following code:
Declare @IPAddressId Int
Exec Login_GetIPAddressId '127.0.0.1', @IPAddressId
Select @IPAddressId
Go
gives Null. Why?
ALTER PROC Login_GetIPAddressId
(@IP... more >>
Creating a database
Posted by Andrew Chalk at 5/30/2007 1:57:02 AM
I am using SQL Mgt. Studio Express (2005). I want to use it to create a
script that will create a database already on one of the servers. I thought
"Script Database As CREATE to" would do this. However, the script created
produces these errors when I run it in SQLCMD.EXE:
Changed database c... more >>
Help needed for converting a correlated query to an uncorrelated query
Posted by Patrick at 5/30/2007 1:32:02 AM
Hello,
I need help in converting a correlated query to an uncorrelated query
to optimize the performance.
The query looks something like this:
SELECT DISTINCT gwcompanyguid FROM ADDRESS0 as adresse WHERE
(SELECT count(Document0.updatetimestamp) FROM Document0 WHERE
( gguid IN (SELECT gui... more >>
Newbie Needs Help - Pivot Query? CASE Statement?
Posted by Chamark via SQLMonster.com at 5/30/2007 1:22:19 AM
Using SQL 2000. Database is based on 14 test questions. Each question is a
separate column that can be answered yes or no. I need direction in creating
a query that would produce results like:
Yes No
Question 1 11 5
Question 2 2 7
Que... more >>
Problem: Trivial?
Posted by Bobby at 5/30/2007 12:21:35 AM
Hi!
I have a Stored Procedure which takes 48 parameters and have a few hundreds
of SQL-code lines. The SP uses few temporary tables, 10-15 selects, some
aggregate functions, groupings etc...
Case 1:
When I execute SP's SQL-code as a 'simple' query (instead of input
parameters I declare ... more >>
INSERT datetime field into database
Posted by karol1208 at 5/30/2007 12:00:00 AM
How can I insert value into field "datetime" type. I try like
'2007-05-29 00:00:00' but I got "Error converting data
type varchar to datatime.". I also try convert(datetime,'2007-05-29
00:00:00',112) but this did not work too. ... more >>
Effects of Left Outer Joins
Posted by Simon Woods at 5/30/2007 12:00:00 AM
Hi
I'm not sure if I understand the effects of left joining properly. I had
assumed that the effects of filter would take precedence over the effects of
the left join but I have an example where that doesn't seem to be the case.
I have 6 temporary tables which I am left joining together an... more >>
Understanding Complex View with 'Fx' - Join in Designer
Posted by Joachim Hofmann at 5/30/2007 12:00:00 AM
Hello,
I have a complex view in a SQL2K Database, made by another person.
Designer Screenshot:
http://freenet-homepage.de/schuttvim/With_Join.gif
In it there is a grafical join symbol which I would really like to understand.
It is a symbol which looks like an Outer Join icon with the char... more >>
Checking a field's value against the default value
Posted by Jason Sweby at 5/30/2007 12:00:00 AM
I've read literally dozens of posts where people want to set a field to its
default value, but I need to iterate through the fields on a table and do
something if its value does not equal its default value.
I'm in a trigger and so I know the table name. I then loop through each of
the fields u... more >>
Hierarchical Data and 5th Normal Form.
Posted by Eric Cathell at 5/30/2007 12:00:00 AM
I am working with HIPAA Taxonomy codes.
5 tables are involved as a base.
Before we really begin, this is an integration project, the original data
sits in a db2 database and the structure is untouchable. Since taxonomy data
is pretty static we are creating a SQL version in our application.... more >>
Inserting default value for a field in an SP. (SQLServer 2005)
Posted by Kursat at 5/30/2007 12:00:00 AM
Hi,
I want to write a stored procedure which takes some parameters and inserts
parameter values into a table. I also want some of the parameters to be
optional. If I omit passing optional parameters SP should insert
corresponding field's default value. I try using -default- keyword for a
... more >>
|