Archived Months
January 2003
March 2003
April 2003
May 2003
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
April 2008
all groups > sql server programming > march 2005 > threads for wednesday march 16

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

Purpose of @@FETCH_STATUS = -2
Posted by gopi at 3/16/2005 10:44:24 PM
Hello All, I have used Cursor quite a few times. However, I have never got an oppurtunity to use @@FETCH_STATUS = -2 though I have seen it being used quite a few times. Would any know why and when this is needed. The BOL is not clear on this also. For example, in this article, why is @@F...more >>


Can someone extend this query?
Posted by Jan Doggen at 3/16/2005 10:16:14 PM
Hello, I want to extend this query: SELECT M.MID, M.MAVID, A.AVOntslagReden FROM Medewerker M INNER JOIN AANVRAGEN A ON M.MAVID = A.AVID WHERE MAVID = 110 to something like SELECT M.MID, M.MAVID, A.AVOntslagReden, 1 or 0 indicating that there are (no) records i...more >>

Unique Index versus Unique Constraint
Posted by Stephen Howe at 3/16/2005 9:00:28 PM
Hi Using SQL Server 7 & 2000 I have never been sure as to when I would want a Unique Index versus a Unique Constraint. Does a Unique Constraint use less resources (is smaller in size)? Are there any Microsoft URLs, whitepapers, etc on this? Thanks Stephen Howe ...more >>

sql grouping question
Posted by James at 3/16/2005 8:37:19 PM
if i have an employee table that has a recruiterID field which joins to the same employee table. how can i create a sql that groups by the recruits sales + recruiter sales? -- 5khzgjf9e001@sneakemail.com ...more >>

SQL Server Timeout expired...!!!
Posted by Chellammal at 3/16/2005 8:04:50 PM
Hi All, When i try to connect Query Anlayser from client to SQLServer Server machine i'm getting Timeout expired. Sometimes it is working. I do not know why. But i changed Server name. Will it impact on client?. But client machine also i changed when i'm connecting.... Is there an...more >>

double inner join
Posted by Hazz at 3/16/2005 7:30:29 PM
select a.xxxx, b.xxxxxx, d.xxxxxx a inner join b where y=z c inner join d where y=q. what do these two inner joins do in simple words? will this be the sum of the two inner joins? As if these were both separate inner joins and the rows that match are basically appended to the rows that mat...more >>

select string problem
Posted by Agnes at 3/16/2005 7:21:20 PM
i got company name in my table which is varchar(100) now, i need to "select left(companyname,50) + left(companyaddress,100) as companyinformation from myCompany" I want my outoput like ABC COMPANY LTD ADDDRESS1 TESTET TRADING LTD ADDRESSS1 as some co...more >>

problem after deleting column
Posted by Sansanee at 3/16/2005 7:02:35 PM
Hi, I deleted a column in SQL and tried to export data to other source, but I get the serialization error. Why this happened? Can anyone help me to solve this problem? Thank you in advance, Sunny ...more >>



How can i Send Query Analyzer Results to Excel
Posted by DMP at 3/16/2005 6:55:53 PM
Hi, How can i send Query Analyzer Results to Excel ? ...more >>

FOR XML query
Posted by Denis at 3/16/2005 6:45:17 PM
Hello I have a query which performs a FOR XML AUTO, ELEMENTS against my table In my table there are some datetime fields The resulting xml has these fields formatted as yyyy-mm-ddThh:mm:ss (2005-03-15T15:30:00) Is there a way to get this fields in a different format? I need dd/mm/yyyy ...more >>

select date problem
Posted by Agnes at 3/16/2005 6:44:12 PM
I want to select the date into the date form (yy-Mm-dd) e.g 05-Mar-16 and then make it as string ...more >>

How to enhance the performance when there is bulk update in trigge
Posted by Stephanie at 3/16/2005 6:35:02 PM
Dear someone who can help, I encounter a problem where the execution of a trigger is very slow (in terms of minute). Below is the example of the trigger that I have been implemented. Assume the trigger is fired on Table1 when inserting. The trigger perform the following - Create a tempora...more >>

CASE
Posted by R Riness at 3/16/2005 6:09:02 PM
Is it possible to use a CASE statement without requiring equality? I don't want to use a search case, but test a value for match or for range: CASE @Integer WHEN 0 THEN do this WHEN > 1 do this WHEN <-1 do that END Thanks in advance. ...more >>

Add in auto number in the query result
Posted by Sql Fren at 3/16/2005 5:39:01 PM
How can I add in the auto-increment field in my query result? E.g Select * from tmp1 The result from this transact sql is VendorName VendorPhone Ven1 123456 Ven2 789654 How can I modified my query to return result as below:( auto number in front) VendorID V...more >>

Check constraints on Tables within UDFs - cannot drop constraint l
Posted by Eric Wilson at 3/16/2005 5:33:01 PM
This is probably obscure usage of the SQL Server feature-set, but any help appreciated. I attempted to include a CHECK constraint in the table-definition for the RETURN table value of a UDF. Like this: create function dbo.MyFunction () returns @r table ( MyColumn int not null, check (...more >>

getting the identity...
Posted by Richard Wilde at 3/16/2005 4:34:22 PM
Hi I want to be able to return the identity of an insert from a linked server? However when the code below runs I get returned a null value .... insert into [presentationlap].scimitar.dbo.tblCoredata (lDataTypeID, sData, lParentID) select TOP 1 lDataTypeID, sData, lParentID from dbo.tbl...more >>

Variable Column width?
Posted by culam at 3/16/2005 4:29:03 PM
Can I declare a variable width of the column, base on the maxium width of a result field. Example. Convert(VARCHAR(DATALENGTH(comment)), commemt) obviously the above code does not work, but I hope you know what I mean? Thanks, Culam ...more >>

randomly select records
Posted by Vince
Hi there! I wondered whether it is possible to randomly select some records in a huge table without having an IDENTITY column within or something where I can apply a 'where' condition ? any idea? thanks a lot Vince ...more >>

How to find out CPU saturation in T-SQL
Posted by Igor Marchenko at 3/16/2005 3:45:52 PM
Hello, I was wondering if there is a way to find out in T-SQL how busy CPU is. I would like to get the same information as shown in CPU usage graph in Task Manager. Thanks, Igor ...more >>

Combining records
Posted by Karl Basson at 3/16/2005 3:03:44 PM
Good day I have a SQL results set that looks like this: CandidateID Nationality 90509 SA 90509 UK 90509 IT 90509 FR I need my results to look like this: CandidateID Nationality 90509 SA, UK, IT, FR Is this possi...more >>

Constraint expression not working
Posted by Jonas at 3/16/2005 2:49:32 PM
Hi! I have a table with users in which I would like to have a constraint making sure that for active users (IsActive=1) a valid user name always exists (OSUserName <> '' AND OSUserName IS NOT NULL). I enter the following constraint expression in the table designer: (([IsActive] = 1 ...more >>

shareware stored procedures
Posted by Mike Steigerwald at 3/16/2005 2:37:25 PM
Hi, all, Are there web sites I can visit to look for shareware stored procedures? I like to reuse as much code as possible, so I'd be interested in sharing and leveraging stored procedures. Thanks ...more >>

**SQL-DMO 21776**
Posted by maryam rezvani at 3/16/2005 2:28:43 PM
Hi I want to change the sa password ,but following error appearred( the picture enclosed), "Error 21776; SQL-DMO the name 'dbo' was not found in the user collection ,if the name is a qualified name,use [] to seperate various parts of the name, and try again." I'd be grateful if anybody can h...more >>

How to handle transaction control when there is multiple connectio
Posted by Peter at 3/16/2005 2:01:05 PM
The situation that I'm trying to figure is how to handle Transaction Control when there are multiple connections, one for each database. My understanding is that Transaction Control is per connection. For example, Connection #1 Begin transaction update table X... in database One Connec...more >>

Gerating sql script with default
Posted by Roy Goldhammer at 3/16/2005 1:59:32 PM
Hello there I have database that i add on there default On the nornal script the tables are run first. Now the tables cannot be created because they are based on the default What i need to do to generate the script from now Or how can i cancel the default? need assistance imergancy ...more >>

Problems with linked server security (mdb)
Posted by Al Blake at 3/16/2005 1:59:06 PM
I have a view in SQLDB A that is built out of a linked server that points at an Access (mdb) database. The linked database is set that security should make connections 'without using a security context'. This works perfectly for user sa. If I select from the view I get data. If I use another ...more >>

Incorrect Results Left Join View
Posted by Lachlan at 3/16/2005 1:55:04 PM
Hi, I have what I believe to be a bug in Sql Server 2000. The symptoms are as per described in KB 321541, although that particular bug was fixed in SP3. I have installed SP4 beta and still have wrong result. My query is quite complex, and when I have tried to create a simple example I cann...more >>

renaming multiple tables in one dts package
Posted by M.Smith at 3/16/2005 1:22:57 PM
is it possible to rename multiple tables in one package? right now I have this and it does not work: sp_rename 'Temp_Table_1', 'Table1'; sp_rename 'Temp_Table_2', 'Table2'; sp_rename 'Temp_Table_3', 'Table3'; sp_rename 'Temp_Table_4', 'Table4'; sp_rename 'Temp_Table_5', 'Table5'; I have ...more >>

No Changes?
Posted by Bruno N at 3/16/2005 1:21:38 PM
Hello All! Im reading a book on SQL Server, and it says it is possible to set a column with 'No Changes' property. I have searched google and i cant seen to find where to set it, can u guys help me out here? Thanks, Bruno N ...more >>

Problem updating multiple tables from a left outer join
Posted by Blake at 3/16/2005 1:11:03 PM
Here is my sql statement: UPDATE t1,t2,t3 SET t1.loadin='2:00 PM', t1.soundcheck='-', t1.dinner='4:30 PM', t1.doorsopen='', t1.advance_volunteers='1', t2.venue_directions='FROM INTERSTATE 64', t1.directionsreceived='2005-03-16 00:00:00.0', t1.concert_info_phone='812-683-2671', t3.promoter_...more >>

Stored Procedure with datareader and string parameters?
Posted by Fred Nelson at 3/16/2005 12:38:29 PM
Hi: I am hoping that it is possible to write a stored procedure that returns both a string value and a datareader to my VB.NET program from a single stored procedure rather than two separate stored procedures. I would like to pass in two parameters - one containing information to produce a ...more >>

Print Query Results from the Query
Posted by GThorne at 3/16/2005 12:25:03 PM
I have a query that I run daily from Sql Analyzer and print the results in text to a printer. What is the SQL code that will take the results of the query and sent them to a printer to print out on paper automatically (using Sql Server 2000). ...more >>

Remote SQL Server login failed for ASPNET user
Posted by Steve P at 3/16/2005 11:51:02 AM
This is a common problem, but none of the methods I read about in the other posts have worked. What is a sure-fire way to get my web application to stop using the ASPNET user for SQL Server authentication? I am trying to connect to a Server on my LAN with a specified username and password. ...more >>

SQL: Multiple SQL statements vs Single SQL statement
Posted by R Reyes at 3/16/2005 11:39:09 AM
Hi, can someone tell me the pros/cons of using multiple sql statements vs a single sql statement? Sometimes SQL statements get so large that one could get lost in breaking all parts of it down. So if for example we had a user info form with id (hidden), name, address, phone--What differenc...more >>

"sa" Login locking resources?
Posted by Rohan Hattangdi at 3/16/2005 11:25:18 AM
I see lock timeouts in my trace and the object_id is for the same table every time. However, something does not seem right - the timeouts all show login = "sa". Also, when I did a trace of lock acquired I see a lot of locks for that table being acquired by login = "sa". There are locks bei...more >>

Row level security
Posted by Marcus at 3/16/2005 11:15:04 AM
Hi. What is a good way to set up "row-level" security in a table? Meaning certain groups of users can see certain rows, but other users cannot. My first inclination was to add an integer column for "groups who can see this row" and set that up like a bitmask (meaning certain bits correspond t...more >>

UDF in computed column for formula?
Posted by Ron at 3/16/2005 11:00:30 AM
Hello, After I pull data into a table from another source, I have to update a varchar column with data based on another column. Specifically, I have a datetime column that will contain a date value. I update the varchar col like this: if date1 col = 1/1/2005, then the corresponding var...more >>

Some questions on Index and locking in transactions...
Posted by Tommy Selggren at 3/16/2005 10:58:11 AM
Hi all! I have a table named tCustomerEnquiry that have the following columns: EnquiryID, SalesUnitID, AuditID, DeliveryAddressID, InvoiceAddressID, EnquiryNumber, EnquiryDate If I do the following begin trans Insert into tCustomerEnquiry(SalesUnitID, EnquiryNumber...etc) values(4, 30...more >>

locks in a stored procedure
Posted by Random at 3/16/2005 10:49:30 AM
Are locks necessary in a stored procedure? I have a short stored procedure where I want to update n records to indicate their intended use in a non-database procedure. I want to select these records based on the priority and scheduled process date, and according to a parameter in the proce...more >>

Refreshing Tables In Database
Posted by Howard Brody at 3/16/2005 10:43:11 AM
I have a stored procedure that creates a table. It works fine except until I refresh the database, the table doesn't appear ... and views and reports can't find it. Does anyone know how I can do this automatically with SQL or VBA (I'm using an Access project as my front end)? Thanks! ...more >>

SQL Operation not allowed when the object is closed Problem
Posted by olie.rej NO[at]SPAM gmail.com at 3/16/2005 10:32:19 AM
Hey... I have installed a new version of my software at my customer's place and I get the error : Operation not allowed when the object is closed Problem when I call any SP I'ved just put in the database overthere... I know you have to put Set NoCount On at the beginning of the SP and put it ...more >>

Retrieving Data from next row
Posted by Nightshade at 3/16/2005 9:51:11 AM
I have a little problem. An example of the data I work with is pasted below. Qry_TestCtrack NAME STATUSTEXT ASSEMBLED LastAssembled Bell B30 Dumper 1st Startup 03/03/2005 07:17:29 03/03/2005 07:17:29 Bell B30 Dumper Normal 03/03/2005 07:18:29 03/03/2005 07:18:29 Bell B30 Du...more >>

creating text file ??? ways
Posted by ~Maheshkumar.r at 3/16/2005 9:50:47 AM
1. How can i create text file using SQL query and T SQL ? 2. How many ways are there to achieve this. ? thnkz -- Mahesh kumar.R ...more >>

Operation canceled
Posted by Emmanuel at 3/16/2005 9:44:34 AM
Hi, I have a stored procedure which can take quite a long time to process. this SP is run from a sql server Job. The SP loops through rows in a table and stores the primary key values of the rows that where processed in a table varaible such that when the loop finishes it executes an updat...more >>

row index
Posted by Harry at 3/16/2005 9:34:39 AM
how can i get the row index using the "SELECT" clause? say i have a 100-row table, and i select one that meets certain critiria. how do i get that particular row's row index. and also, given a row index, how can i select the row of that index? i am looking for best practice because my tab...more >>

sp_executesql
Posted by gtr at 3/16/2005 9:33:03 AM
I have some tsql code in a proc that uses a cursor. I am trying to replace the cursor with a table variable. The cursor is based on a table name that is not known until run time - therefore a cursor variable is defined and opened via sp_executesql. The curosr variable is an output parm to...more >>

Finshed 2071b
Posted by Dave S. at 3/16/2005 9:20:57 AM
An ok start. But anyone have a recommendation for an advanced Trans-act SQL book, or other training material? ...more >>

API calls from within a Stored Procedure?
Posted by Crisp at 3/16/2005 8:49:08 AM
Folks, I would like to convert some macros into a stored procedure. The idea is to read file names out of a database and copy them from their current location to specified directories. Can an API call be made from a SP to prompt for a root directior (via file dialog), create a directory, and...more >>

file Server and Ful text indexing
Posted by Sathian T at 3/16/2005 8:47:32 AM
Dear All, Is it possible for SQL Server to search on documents which are not inserted into the database? for example does SQL Server have the facility to scan the documents, keeping the documents in the fileserver itself and doing full-text indexing on them taking only the token words from ...more >>

Read of XML File
Posted by mvp at 3/16/2005 8:39:01 AM
Hello, I do have XML file in c:\project.xml, this file is arround 60 MB file. Now i want to use EXEC sp_xml_preparedocument @idoc OUTPUT, @doc and then OPENXML to load xml into sql server table, so how can i pass that xml file to EXEC sp_xml_preparedocument Pls help...more >>

Help with sp code - cursor
Posted by bill_morgan at 3/16/2005 8:01:01 AM
Friends, When I step through the following code in QA it works fine - when I alter the proc and run it, I get an error (you should be able to copy the code as it is into your own QA for testing) - Anybody know where I am making the mistke? Thanks in advance for your help ... Bill Morgan ...more >>

Time & date
Posted by Peter Newman at 3/16/2005 7:59:03 AM
I have a varchar passed which contains a date dd/mm/yyyy I am using the following to put it in a date time field declare @ndate varchar Set @ndate = '17/03/2005' CONVERT(DATETIME, @nDate, 103) this put the data in as 2005-03-17 00:00:00 is it possible to get the time set to the time t...more >>

Need help with SQL Code
Posted by Nate at 3/16/2005 7:33:02 AM
I am trying to create a record number. Don't ask why LOL. Below are the items I need in my record number. Here is the format I'm looking for. I am also having problems trying to get it to display zeros before numbers such as 1. Ex. 1 should be 01. This would be stored in a text field. ...more >>

Error while deploying CLR Assembly.
Posted by Sameer Dehalvi at 3/16/2005 5:47:03 AM
Hi, I am using Whidbey and Yukon. I am creating a CLR SP in whidbey and trying to deploy. I am getting the following error, Error: Failed to initialize the .NET Framework: 0x80004005(Unspecified error). You need to restart server to access .NET Framework functionality. Any one any id...more >>

Critical issue.
Posted by Enric at 3/16/2005 5:45:04 AM
Dear all, I need to have in Barcelona a db allocated in Rio de Janeiro. That .MDF, after dbcc, shrink and a good maintenace own 100 Gb. How can they send me that information in a just two days??? NO DVD. DTS (forget it) BCP (forget it) Thanks a lot, ...more >>

Inserting values in a datetime field
Posted by kd at 3/16/2005 3:49:02 AM
Hi All, I have a datetime column in a table on the SQL database. I need to insert values into the datetime column from vb.net code. Here is my code: dim nameval, str, qry as string nameval = "abc" str = "2005/03/16 14:20" qry = "insert into tab1(name,dateval) values(" & "'" & nameval & "',"...more >>

Parse Column and Sort
Posted by Boss at 3/16/2005 3:25:03 AM
Hi can anyone give your idea on how this can be implemented. I have a table which has a column whose values looks like Page 10 Line 1 Document 1 3 Sheet: Landscape Sheet: Part 2 Page: 29 Line: 2 Page91 Page 10 Sheet: Sheet1 i need to sort by Page number and line number if no line n...more >>


DevelopmentNow Blog