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 > april 2004 > threads for wednesday april 14

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

constraint vs index
Posted by George at 4/14/2004 11:14:00 PM
Other than syntax, is there any difference between a unique constraint and a unique index? Or, assuming they are different, what causes a constraint to become an index? thanks a bunch!...more >>

Is it possible to create a DB and tables in the same Stored Procedure
Posted by Veda at 4/14/2004 8:51:05 PM
Hai I want to create a Database say, (MyTestDB) and few tables for it in one SP That SP is present in the database (MyDB) when i try to do this, it says, Database "MyTestDB" does not exist Plz let me know how it can be resolved..??! Thank u ...more >>

UPDATE Trigger
Posted by PaulJS at 4/14/2004 7:01:03 PM
Hi I'm new to SQL Server and am trying to learn some of the fundamentals. I have a table, "Vendors", with the usual fields like Name, Address, etc. Two of the fields have some relation to each other. One field is "Discontinued", the other is "Preferred". If a Vendor is "Preferred", then I want ...more >>

Compare Image Type
Posted by Christian Perthen at 4/14/2004 6:53:40 PM
Hi, I am working on a large image database and would like to delete duplicate image regardless of their filename. I know that I can't compare image type so is there a way to also store the image as hex or binary in another data type and from there compare it? Any insight or techniques on th...more >>

GROUP BY question
Posted by Utada P.W. SIU at 4/14/2004 6:39:05 PM
I need group a set of data by using the field "country" here is my table structure id customer_name gender address quota country register_date and I need the result like as below id customer_name quota country register_date what is the sql statement?? ...more >>

Query tuning -- taking long time
Posted by Meher Malakapalli at 4/14/2004 6:19:20 PM
Hi, I have a very serious problem. The following Query written by one of our SQL guys is taking enoromous amount of time to return the data, so much so that my tempdb gets filled up in no time. Due to this Query taking long time we made a switch of the tempdb mdf file to a bigger hard drive an...more >>

how to find date/time of last table (structure) change
Posted by Bruce H at 4/14/2004 6:13:13 PM
Is there a way I can look for a last-modified date/time for tables, columns, (constraint changes, new indexes, etc, etc.)? I'm working on a project which will synchronize changes between SQL Server 2000 and another RDBMS. The ultimate goal is to switch everything to SQL Server, but it'...more >>

How to store measurement data
Posted by Aaron Prohaska at 4/14/2004 5:29:27 PM
I am in need of some advice on how I should store data for customer measurements. The measurements could be entered as a number of different types like inches/centimeters, pounds/kilograms, as well as different shoe size types. The user is going to into their size for a specific measurement...more >>



Subquery question
Posted by Dave at 4/14/2004 5:11:32 PM
I need to select from a set of custids that I derive by identifying all the duplicates. I can write a subquery that returns the custids that are duplicates but then it also returns a count so I cannot use the subquery with an IN clause. For example, the following won't work because the subquer...more >>

xml data type
Posted by Sharon at 4/14/2004 4:24:11 PM
hi. does any one know if an xml data type, that contains an already parsed xml doc, will be added to sql server? this kind of data type, will enable better usage of xpath expressions in queries. thanks. ...more >>

Stored Procedures
Posted by j.m.autry NO[at]SPAM earthlink.net at 4/14/2004 4:11:21 PM
Are stored procedures the way to go on all DB designs? ie. Are there any reasons not to design a database system using stored procedures?...more >>

Here is a good one for you (sequential numbering)
Posted by Ivan Demkovitch at 4/14/2004 3:58:02 PM
I need to populate SeqNo column in a table: CREATE TABLE #Lines (LineKey Int NOT NULL, SOLineNo Int NULL, IsPref SmallInt NULL, SomeID Char(20) NULL, SeqNo NULL) ...more >>

Syntax error in correct "alter table add..." statement (in loop)
Posted by Lars-Erik Aabech at 4/14/2004 3:43:33 PM
Hi! I've got this humongous stored procedure that generates a temporary table, kind of emulating a pivot table. But now one of the databases has suddenly got this weird hiccup.. An "alter table add.." line which is completely correct suddenly fails with no apparent reason (The last one..). ...more >>

How to find the current database selected
Posted by Suresh Kumar at 4/14/2004 3:32:51 PM
I am writing a generic system stored proc that will be placed in the Master database to be used by all users. (Without boring you guys with the details) I just want to know the currently selected database inside the stored proc. i.e what was the last USE command done before they inoked the store...more >>

Split text column
Posted by Mark at 4/14/2004 2:59:16 PM
I have a text column in my table. I would like to split data from it into two columns. I know what character is a separator. How would I do that?...more >>

decimal value formatting
Posted by xyz12 at 4/14/2004 2:49:25 PM
Hi all, Is there any way to format a decimal value into this kind of format in a SQL query? 9,999,999.87 Thanks, xyz12 ...more >>

Find all tables without PK or UQ
Posted by TVODBA at 4/14/2004 2:16:03 PM
SQL 2000 sp3 I need a query to find all tables in a DB that do not have a Primary Key OR a Unique Constraint I've tried several iterations of joining sysobjects and sysconstraints but Tables that only have a UNIQUE INDEX with nothing else are not being excluded Here is one of the queries I've b...more >>

How do I copy table structure/indices/contraints to a new table using TSQL
Posted by Jerry at 4/14/2004 1:17:58 PM
Hi, there, Does anyone knows How to copy table structure/indices/contraints to a new table using TSQL? Either within the same server, or between server. Thanks....more >>

Table to text file
Posted by Selva Balaji B at 4/14/2004 12:55:37 PM
Hi All, Is there a way to write the records of sql table to a text file.(without using export utility) Thanks in advance, Selva Balaji B. ...more >>

[ODBC SQL Server Driver]String data, right truncation
Posted by Guy Brom at 4/14/2004 12:37:04 PM
After re-installing my mssql2k server, I get this error: OLEDB:[Microsoft][ODBC SQL Server Driver]String data, right truncation I'm using the latest mdac (2.8), I unchecked "use regional" from odbc settings and changed to a sql_latin_bin collation. Nothing seems to help, is there any workaro...more >>

How to select only one name per company?
Posted by Nicolas Verhaeghe at 4/14/2004 12:16:55 PM
I have many companies with more than one subscriber in my Eclipse database. customer_address has the following fields: fname lname company address1 address2 city state zip How can I select randomly (first name that comes up is fine) one and only one fname and lname per company, addres...more >>

Extended Stored Procedure!
Posted by tuand2001 NO[at]SPAM yahoo.com at 4/14/2004 11:41:09 AM
Hi all, Is there any undocumented extended stored procedure out there that I can use to give me a last modified date of a file when I pass in a full path of the file on the network. thanks, Tom...more >>

Email from SP problems.
Posted by Matt Lemon at 4/14/2004 11:11:55 AM
Hi, I'm using a stored prcedure to go through a table and email contents of that table. The SP is as follows : ____________________________________________________________________________ ____________________________________________ declare abc cursor for select TradeMarkOwner, TradeMark...more >>

DTS and VB
Posted by Rafael Chemtob at 4/14/2004 11:04:46 AM
Hi, I'm trying to create a DTS package and execute it via VB. This is the description of the DTS task: 1. Source: txt file that is comma delimited. 2. Destination: Table in the SQL Database 3. I have a data transformation task between them. If I run this on the SQL Server local pacakges ...more >>

UPDATE syntax
Posted by shank at 4/14/2004 10:48:26 AM
I'm getting the following error... What the heck am I doing wrong here? I want to update the field ItemStock.Inv to 0 of the 2 tables match on the OrderNo field. thanks! Incorrect syntax near the keyword 'INNER'. ---------------------------------- UPDATE ItemStock INNER JOIN OutOfStockInv O...more >>

Transpose Table
Posted by Christian.Akcoskun NO[at]SPAM eds.com at 4/14/2004 10:23:06 AM
How can i transpose a Table in Micrososft SQL... I have to switch rows into columns. For example: Col1 Col2 Col3 ****************** aaaa 1111 2222 bbbb 3333 4444 cccc 5555 6666 And i Want to transpose it to: Col1 Col2 Col3 ****************** aaaa bbbb cccc 11...more >>

SQL Server Open Data Service API Examples?
Posted by chelseagraylin NO[at]SPAM hotmail.com at 4/14/2004 10:21:04 AM
Does anyone have a code example for calling a java class or a Web Service via the SQL Server API? Thanks!...more >>

Union of two stored procedures
Posted by Michael Welz at 4/14/2004 10:20:38 AM
Hello NG, is it possible to union tow stored procedures?? the following statement isnt working: sp1'x','y','z' union sp2 'x','y','z' how can i solve the problem? Best regards, Michael ...more >>

Using OSQL
Posted by rob at 4/14/2004 10:08:25 AM
I have an accounting app that will provide a vendor number using the accounting apps "trigger" point... Is it possible to pass that value to a stored procedure and execute it using osql ? If so, does the input need to be placed in an input file ? Any examples ? ...more >>

Sproc parameter: escaping ' character
Posted by Marina at 4/14/2004 9:56:43 AM
Hi, Let's say I'm trying to execute a stored procedure by calling 'Exec'. If an argument to the sproc has a single quote (which is doubled up), then the whole thing dies with a syntax error. Consider this: Exec MySproc 'arg1','here''s arg2','arg3' For what it's worth, the syntax highligh...more >>

Populate a field with MAX(column) + 1 : Round 2
Posted by Scott Lyon at 4/14/2004 9:51:00 AM
This posting is very similar to a posting I made back in February. But my circumstances have changed just enough, I thought it might justify another post. I have the following table structure set up: CREATE TABLE [dbo].[MESSAGES] ( [MessageNumber] [int] NOT NULL , [Release_ID] [numeric...more >>

Slow running Cursor
Posted by David Russell at 4/14/2004 9:46:07 AM
Guys I am running a sproc that creates a cursor on joined tables on a linked server. When I run the SQL statement outside the cursor it run fine (quickly), but when I run it inside a cursor and step through it is too slow for words. It also throws a warning message about Isolation levels not bei...more >>

retrieving the current database name
Posted by Daniel P. at 4/14/2004 9:43:49 AM
Does anyone know how to get the current database name? Something similar to SELECT @@SERVERNAME ? Thanks! ...more >>

Error in Executing Stored Procedure
Posted by Sheldon at 4/14/2004 9:36:44 AM
I am running the desktop version of SQL Server 7 with SP4. I have created a stored procedure that I am trying to execute. I am receiving a msg 208 "invalid object name". It involves the location of the source table(trans.dbf). The portion of the code is as follows. declare trans_Cursor C...more >>

Datatype for stringvalues containing several NULL bytes
Posted by André Teig at 4/14/2004 9:23:10 AM
Can I use the CHAR datatype for data that contains null bytes inside the string? Ex: lsdfjølkj\0sjdhkjh jh kjh kjhs\0\0\0kjh 7346k (Nullbytes here represented by \0) André -------------------------------------------- André Teig Respons AS, Stasjonsgt. 37, 1820 Spydeberg Mob: 91 77 6...more >>

User-Defined Function
Posted by tuand2001 NO[at]SPAM yahoo.com at 4/14/2004 9:13:09 AM
Hi All, I need to create a sql user-defined function to give me a last modified date of a physical file on a network. input would be a full path of a file. Thanks, Tom...more >>

reindex versus maintenance plan
Posted by Jo Segers at 4/14/2004 8:49:55 AM
Hi, I would like to reindex all the tables in my database by using a job instead of a maintenance plan. In a maintenance plan this is possible with the checkbox: "reorganize data and index pages". How can I do the same thing in a script without using DDBC REINDEX for every table? ...more >>

DBCC REINDEX vs maintanance plan
Posted by Jo Segers at 4/14/2004 8:44:14 AM
Hi, I would like to reindex all the tables in my database by using a job instead of a maintenance plan. In a maintenance plan this is possible with the checkbox: "reorganize data and index pages". How can I do the same thing in a script without using DDBC REINDEX for every table? ...more >>

Query Anaylser - Results to File (.rpt)
Posted by rikesh at 4/14/2004 8:28:10 AM
Hi I was running some queries last night, in Q.A and I came across an option, which said 'Results to file' , well I selected this option, and it allowed me to save the results as an .rpt file. However I am trying to open this in Crystal Reports (8.5) and it will not let me......Anyone know th...more >>

unique constraint vs unique index
Posted by alex at 4/14/2004 7:19:12 AM
what is the difference between an unique constraint and an unique index? thank you *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!...more >>

Using a table as input parameter to a stored procedure
Posted by sr.Facanha at 4/14/2004 6:52:11 AM
Anyone know how I can do a stored procedure that receives a table as a parameter. I tyed to use de table data type, but always the creation o the sp fail with the message Incorrect syntax near the keyword 'table'. An example of the code tried CREATE PROC dbo.p_test @testtable table(testf...more >>

Can we even do this
Posted by srikar at 4/14/2004 6:36:02 AM
Can we create alias to a database ...more >>

How to change the mode
Posted by Sharad at 4/14/2004 5:59:03 AM
Dear Friends I have installed MSDE 2000 and now i want to change the mode from windows to MIX mode please suggest how i can do the same with OSQL as i do not have query analyser and the enterprise manager. Your earlier reply would be great help. Best regards Sharad...more >>

OpenDataSource
Posted by Sunanda at 4/14/2004 5:16:03 AM
I have a SP in server 1 which accesses the tables in server2 as follows Select from OpenDatasource(...).dbname.dbo.table1 t join OpenDatasource(...).dbname.dbo.table2 t on. ... where.. The above code works perfectly fine. The only problem is I am not able to add "with(nolock)" to the state...more >>

date time format
Posted by Owen at 4/14/2004 4:05:29 AM
Hello: I have a storeprocedure with parameter @FromDate datetime I inside it: @DateQuery = 'where [date] > ' + @FromDate Exec (@FirstQuey + @DateQuery + @LastQuery) But I got a error: Syntax error converting datetime from character string. Best Regards. Owen. ...more >>

How to Use an IIF Statment within an SQL Query
Posted by Dave Salmon at 4/14/2004 3:22:01 AM
If I wanted one output column from a select query to be dependant on the contents of another column. Using Access, I would simply have an expression - 'iif (a = "fred", "Yes", "No") in which case, if column 'a' contained 'fred', the column containing the expression would contain "yes" in t...more >>

Having more copies of backup log file
Posted by Checco at 4/14/2004 2:51:03 AM
I need to have two copies of the backup log file, created by a job, without coping them on the filesystem, but creating them whit a scheduled job. Every 5 minutes the job backup the log on a network folder, i need to backup the log on another network folder, so i have two copies of the same file. Wh...more >>

Created a computed column that references itself
Posted by michaelAngelo at 4/14/2004 2:31:02 AM
Hello. I had this problem at work: i need to have a computed column that is computed using a function This function must reference the same column that uses it to create the new value for the column. As you can see, this creates an infinte recursion. Is there any setting for computed columns that...more >>

trigger problem!
Posted by Owen at 4/14/2004 2:15:57 AM
Hello: I've a table with this structure: - id, name, parent similar to a tree structure. I want to do a trigger that when erase one node, all his childs been erase too. someting like this: CREATE TRIGGER [DeleteChilds] ON [dbo].[tblDescriptors] FOR delete AS delete from tblDescri...more >>

nested cursor declarations through dynamic sql
Posted by whitegoose NO[at]SPAM inorbit.com at 4/14/2004 1:03:24 AM
OK... I need to get a list of file names from an Excel spreadsheet. As the file name and path etc may change I have made them variables and declared a cursor that uses opendatasource() to get the file names out of the xls. For each of the values retrieved, (in this case an example value is 'T...more >>


DevelopmentNow Blog