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 > january 2006 > threads for thursday january 19

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

inserting single precision data into sql server float column
Posted by Vivek at 1/19/2006 11:17:03 PM
Hi, iam using the bcp api to load data into sql server. The data to be loaded is single precision and hence my bcp_bind type is SQLFLT4. The column in my sql server table is a FLOAT(which is of course double precision). If i try to insert say a value 73.22 it gets inserted as 73.220001220703...more >>


Funny! More offers to select a search engine! (PP)
Posted by world at 1/19/2006 8:29:41 PM
wycareerster ...more >>

SQL Help - dynamically change where condition
Posted by Mike at 1/19/2006 7:15:02 PM
I am trying to modify the where condition of this query based on certain values that will be passed to this query. I get this error Incorrect syntax near '!'. select emp_id, emp_name from employee where emp_code = 'FIN' and case when ('889977' != '') then (emp_id != '889977') else...more >>

SQL dilema
Posted by T at 1/19/2006 6:26:02 PM
I have a table with the folowing few lines of data. 4460 Alexander, Julie A. 12 5 11/10/2005 0.0 4460 Alexander, Julie A. 12 5 11/11/2005 0.0 4460 Alexander, Julie A. 12 5 11/14/2005 0.0 4460 Alexander, Julie A. 12 5 11/15/2005 0.0 4460 Alexander, Julie A. 12 5 11/16/2005 0.0 4460 ...more >>

3 tables ...
Posted by Jarod at 1/19/2006 5:22:23 PM
Hey I have 3 tables : Jobs table jobID jobname JobQuestion id jobID questionID points Question questionID questionText I'd like to join this tables so that I have all names of jobs and points for given question. It doesn't matter if the question has it's row in jobQuestion tab...more >>

GetDate inside a Function
Posted by John at 1/19/2006 4:42:03 PM
Hi, I tried to use GetDate inside a SQL server 2000 user defined function and got error: Invalid use of GetDate within a function Here is my code snippet: DECLARE @Today smallDateTime SET @Today = GetDate() What should I do? TIA ...more >>

on insert trigger and a linked server?
Posted by darwin at 1/19/2006 4:40:02 PM
Hi all Is it possiable to use an on insert trigger to insert the same record into another server (linked)? Any hints or issues with this would be appreciated. thanks...more >>

performance on the join
Posted by culam at 1/19/2006 4:30:02 PM
I know that join on an integer field is faster than join on varchar field. What if I cast the fields to integer within the join clause, ex. JOIN CAST(tableA.field AS int) = CAST(tableB.field AS int) would this speed up my query? Thanks, Culam ...more >>



Cant It be Done?? Backup mdf and ldf only
Posted by Sean John at 1/19/2006 4:04:44 PM
Can you backup database that has .mdf, .ldf, and .ndf and restore only ..mdf and .ldf? Reason is if you have a large table thats part of a filegroup and you want to restore database to another sever and not the filegroup(.ndf)?If so how and example syntax would be great!TIA *** Sent via D...more >>

Programatic replication
Posted by Dave S. at 1/19/2006 3:33:19 PM
I have SELECT access to a database that is very, very slow to work with to the point where I am looking to replicate at least one table to my own server to use the data locally. What is the best way to check for new records if the table key is not incremental? I prefer not to try a "If exists" o...more >>

User Instances and Scripts
Posted by Ibrahim Mesbah at 1/19/2006 2:58:02 PM
I have been reading about SQLExpress User Instances. I deployed a C# app that uses sqlexpress' user instance functionality. I need to deploy an upgrade with a fix to certain stored procs.. I figure I could use sseutil or sqlcmd to run a .sql script upgrade file that has a lot of t-sql i...more >>

CTE vs. Table Variable (Paging)
Posted by Eyal at 1/19/2006 2:56:01 PM
Hello Experts. I'm trying to find the pros / cons of using CTEs (Common Table Expressions) vs. Table Variables for 'Paging' through data. Here is the scanario: A. Table Variable Example: Select Query returns 100k posible matching rows, I store the matching key column along with an i...more >>

generate three rows out of one row from a table
Posted by sqlguy at 1/19/2006 2:25:08 PM
i've two tables as shown below, i want to generate the table2 using table1, more details -- for each in table1 i want three rows in table2 these three rows col2 says A, B, C table1 ------- c1 -- 1 2 3 table2 ------- c1 c2 -- --- 1 A 1 B 1 C 2 A 2 B 2 C 3 A 3 B...more >>

SQL Server Browser service?
Posted by Igor Solodovnikov at 1/19/2006 2:22:24 PM
MSDN describes SQL Server Browser as "SQL Server Browser is the name resolution service that provides SQL Server connection information to client computers." But i can connect remote SQL Express instance even when SQL Browser service is stopped. Moreover instance is listed in SQLDMO.A...more >>

Consoldate columns in a SELECT
Posted by Terri at 1/19/2006 2:17:48 PM
I have a vendor supplied orders table that tracks the fee types associated with an order. The allowable fee types are A, B, C, D, and E. These fee types can be in anyone of the six fee code fields. In the corresponding fee amount field is the fee amount. The application allows NULL fee amounts ev...more >>

can't insert into ...because of nulls problme!
Posted by Rich at 1/19/2006 1:55:02 PM
Hello, I am trying to insert some records into a table from an SP but get this message: Server: Msg 515, Level 16, State 2, Procedure stp_InsetIntoSubDetail, Line 6 Cannot insert the value NULL into column 'CurEntryDate', table 'Subscriber.dbo.SubDetail'; column does not allow nulls. INSE...more >>

Help on "splitting up" data in a field
Posted by Steen Persson (DK) at 1/19/2006 1:34:07 PM
Hi I'm having a problem finding out how I can split data in one field and then use the values to match records in another table. In table 1, I have a field where the values looks like e.g. "229 231 233 235". What I'd like to do, is to match these 4 numbers with an ID in table 2 to get th...more >>

Another Temporary Table Q
Posted by Simon Woods at 1/19/2006 12:40:29 PM
Hi I've been playing around with temporary tables ... everything works fine, but I've read a few articles saying how they can affect overall performance and I'm wondering if there may be a faster alternative performance. Basically, the user fires off a query at the DB. With the results, I ...more >>

big log file
Posted by Owen at 1/19/2006 12:34:25 PM
Hello: I have a db with 2 data files and 2 log file, but one log files is about 9GB, I would like first reduce the db to only one pair of file, one data and one log and second reduce the size of log about 1gb or 2. how can I do that? Best regards, Owen. ...more >>

Backup Contains .mdf .ldf and .ndf dont want .ndf
Posted by Sean John at 1/19/2006 12:25:41 PM
Hello, I have a database(.mdf and .ldf) with a large table that is attached to its own filegroup(.ndf). I have created a full database backup and used Restore FilelistOnly From Disk = 'C:\MSSQL\Data\Backup\Contact.bak' I see 3 files contact.mdf contact.ldf cont.ndf I restored ju...more >>

Stored procedure in asp timeout
Posted by Ró¿añski at 1/19/2006 12:12:32 PM
Asp page loaded in 4 seconds and after few hours it takes about 2 minutes to load. When I run it from QA it takes about 3 seconds. Simple SQL Select works fine the problem is only with stored procedures. Server is runnig W2003 and SQL2000 I've also installed SQL locally on Windows XP Pro wi...more >>

Temporary Tables
Posted by Simon Woods at 1/19/2006 12:11:15 PM
Hi I'm creating temporary tables using the # or ##. Is this the only way to do this with SQLServer or is there a way to indicate that the table is a local/global temporary table using a keyword? I notice, for example, that Oracle/MySQL has it as part of the Create Table syntax e.g.- CREAT...more >>

Encrypting Stored Procedure Code
Posted by darrin.wilkinson NO[at]SPAM cma.ca at 1/19/2006 11:13:07 AM
Hi, Is it possible to encrypt the code within a stored procedure in Microsoft SQL Server? My example is: I've written a stored procedure. I don't want anyone to be able to view the contents/code within this stored procedure unless I allow them to see what is in it. Thanks, Darrin ...more >>

how to read a 1204 and 1206 trace log entry
Posted by jason at 1/19/2006 11:00:59 AM
so i'm investigating deadlocks which occur on the database i am responsible for. i've put in place a 1204 and 1206 trace, and now i'm just curious how to interpret the findings. i have read the BOL section on troubleshooting deadlocks, which list the entries for the 1204 trace, but they don't se...more >>

Stored procedure problem - update help needed
Posted by ROBinBRAMPTON at 1/19/2006 10:55:40 AM
Hello everyone, I'm using the following procedure to do two functions. 1) Extract all zip codes from a database of American zip codes, which falls within a 15 miles radius from a predefined zip code (variable @zipcode) Then... 2) Compare the results to a zip code column in a customers tabl...more >>

Using output parameters in SQL Functions
Posted by praveen at 1/19/2006 10:22:35 AM
Hello Friends, I'm trying to use an output parameter in a function. But it seems the syntax I used is incorrect. May I know the correct syntax for using an output parameter in a function. Sample Function I used: create function dbo.OutputFunction (@var int output) returns int as begin ...more >>

SMO-license
Posted by Fred at 1/19/2006 10:17:01 AM
I'm writing a application using SMO, however, I have some doubts regarding the redistribution of this application, commercially. Is it possible? What is necessary legally speaking to redistribute? Thanks in advance ...more >>

Job/DTS Scheduled Execution
Posted by Rob Meade at 1/19/2006 10:07:17 AM
Hi all, Just a quick question... I have 2 DTS's - one which imports a small amount of data (about 60 rows max), and another which imports about 20,000 rows (and will increase over time). I had a job running the smaller import every two minutes (as it reports real time data) - I've add...more >>

How to get the name of the column that is an Identity Column
Posted by CSHARPITPRO at 1/19/2006 9:40:04 AM
I would like to know the best method of getting the name of the column if it is an IDENTITY column. I need to remove the IDENTITY property on all tables. Thanks...more >>

Job issue
Posted by Enric at 1/19/2006 9:37:05 AM
Dear all, I want to define a job which might be able to launch a .BAT where its location is my local workstation. Is it possible? That .BAT call a .EXE and we wish to keep out of our production server. That job will be scheduled from the server... Thanks a lot,...more >>

Query Timeouts--Indexing Questions
Posted by Larry Menzin at 1/19/2006 9:31:02 AM
I am helping a client with query timeout issues. Their tables have an identity field used as a primary key, with a clustered index on the primary key. This key really has no functional significance; it is just a number. One example is that they search for customers by phone number, with an ...more >>

Is there a better way to write this?
Posted by Nestor at 1/19/2006 9:21:22 AM
I have a set base query which is causing me problems.... the query look like this insert into TableA (columnA1) select columnB1 = (select columnB1 from TableB where columnB2 = a.columnC2 and columnB3 = a.columnC3) from TableC as a It's actaully population of a fact table from dimension...more >>

Help obtain a window of rows from a table
Posted by James at 1/19/2006 9:12:29 AM
Hi, I have a client program in vb.net that access a SQL server database. Each time the client program need some data it retrieve the whole table, so it is pretty slow. I wonder if it is possible, for the client, to retrieve only a window of rows around the actual value he is using. That ...more >>

sql division
Posted by me at 1/19/2006 9:10:03 AM
why do i get 0 when I do select 1/2 ????? declare @a float set @a= CEILING(1/2) print @a I get 0 , I want to get a result of 1 Thanks...more >>

statistics io question
Posted by ChrisR at 1/19/2006 9:02:02 AM
When I use "set statistics io on", which of these is the worst? Table 'CaseHearing'. Scan count 1, logical reads 1195631, physical reads 0, read-ahead reads 0. Table 'User'. Scan count 99, logical reads 199, physical reads 0, read-ahead reads 0. As you see the "user" table has many scan...more >>

VS.NET 2003 and Stored Procedure Debug
Posted by Jason Givens at 1/19/2006 8:46:05 AM
Here is my setup: Server Windows Server 2003 SQL Server 2000 (SP4) Client Windows XP (SP2) VS.NET 2003 I am trying to debug a stored procedure in VS.NET using the Server Explorer and the “Step Into Stored Procedure” option. When I do this, the procedure starts and just wait...more >>

Object search feature
Posted by Enric at 1/19/2006 8:46:02 AM
Dear folks, I am looking for a script which be able to replicate the same functionality that 'Object Search' from QA (F4 key). I am looking for a specified column in a database and the problem is that from the results panel of 'Object Search' is not enabled the multiple selection so the way...more >>

Which sp is causing the blockings...?
Posted by SammyBar at 1/19/2006 8:36:01 AM
Hi, By using sp_who active I cant find the blocking proccess. But how can I know in which stored procedure is the code causing the blocking? I'm having long blockings from some application but I can't guess which one. It is a heavy used production server so I need a non intrusive way to det...more >>

Return random number from trigger
Posted by David Chase at 1/19/2006 8:35:43 AM
I have a trigger on a table that creates a random number for the Primary Key. I want to be able to return that random number to my program somehow. I tried the RETURN but it is not allowed in a trigger. My trigger code is below. Any help is appreciated. David CREATE TRIGGER T_People_I...more >>

Returning Duplicate Records
Posted by Eric at 1/19/2006 8:07:03 AM
I have a Transactions table w/the following columns (all VarChar): CustomerID, Customer_Name, User_Name And and Admin table w/the following columns (VarChar): User_Name, Company_ID Now I want to return any records where the CustomerID is duplicated for different Customer_Names when G...more >>

SQL 2005
Posted by Mike Labosh at 1/19/2006 8:05:25 AM
Greetings, all: Now that I have acquired the software [OMG the new EM+QA Hybrid RULEZ!] Could anyone recommend serious books on SQL 2005 that are not Microsoft Official Curriculum? (I already have those) Please also comment on why you recommend whatever it is you're recommending. Thanks!!!...more >>

Parse w3c Date and Time in SQL Server 2000(sp4)
Posted by Prasad at 1/19/2006 8:02:03 AM
Hello, I am trying to save w3c(http://www.w3.org/TR/NOTE-datetime) date and time value in sql server datetime field. I am getting "Syntax error converting datetime from character string." Here is the sample date '2006-01-11T15:20:40.0000000-05:00'. I can extract date part using LEFT(CONVE...more >>

Indexed Views, Space Used.
Posted by LineVoltageHalogen at 1/19/2006 8:01:34 AM
Potentially stupid question but here goes: Does an indexed view require extra space (due to data being copied) or is it just a logical construct that uses existing table data? Thanks, TFD. ...more >>

Stored procedure; add row to ouput result set
Posted by Billy at 1/19/2006 7:31:03 AM
I have a stored procedure thtat returns two columns, sample returnset: id name 1 DHL 2 UPS The procudure is called like this: exec getTransporter I want to add a row to the output so the output would be like this: id name 1 DHL 2 UPS 0 All SO pseudocode for my question is like th...more >>

nolock
Posted by peppi911 NO[at]SPAM hotmail.com at 1/19/2006 6:36:37 AM
Hi, i wonder how to set the nolock option. if i use subviews do i have to go througg all of them to find all tables and add nolock or does it affect the subqueries automatically? is there a database switch i can set which affects all select statements if that wont work to save time selec...more >>

Problem of Permissions for Linked Servers in .net page
Posted by savvy at 1/19/2006 6:35:23 AM
I searching using Keywords in MS Word and pdf documents for which i have used the Index Server and linked with SQL Server but when i am running the stored procedure thro my webpage i'm getting these errors. And when i run this code in Query Analyzer its giving expeceted results. I dont know wher...more >>

Queries for Back up and restore the databases
Posted by Sundar The Great at 1/19/2006 6:26:34 AM
Hi, I would like to know what are the queries for back up and restore of the DB in SQL Server. Kindly help. Thanks in advance. urs, Sundar The Great! ...more >>

SQL Statements or Table Redesign
Posted by walt NO[at]SPAM clubknowledge.com at 1/19/2006 5:21:29 AM
Hello all! I have a Master Table of Companys field [ID] is Primary Key I have another table of Programs the Comapny has bought. tblCustProgs [ID] [ProgID] [CompanyID] Sometimes I need to be able to do some sort of JOIN query where ProgID= SumNum and ProgID=SumOtherNum Each Com...more >>

Usage of RaiseError
Posted by SqlBeginner at 1/19/2006 2:28:03 AM
Does returning specific error codes/numbers from Stored procedure have any performance issues? Instead of just returning 1 or 0 as return type always .. if a particular input value doesn't exists in the DB then we could sent error code 100. So that in the front end .. the guys can have a ke...more >>

Scheduling DtsBackup2000?
Posted by Enric at 1/19/2006 1:55:01 AM
Dear folks, Is it possible? Show us a instatiable model such application? I would like to develop any which might be able to start and do the weekly transferences to disk (.dts,.dtb). Thanks for any comment or idea, ...more >>

TDS buffer length too large
Posted by Digal at 1/19/2006 1:43:02 AM
This is the error I am getting when I run a procedure... [Microsoft][ODBC SQL Server Driver]Unknown token received from SQL Server [Microsoft][ODBC SQL Server Driver]TDS buffer length too large Connection Broken...more >>

Help on passing param to store procedure ???
Posted by serge calderara at 1/19/2006 1:42:02 AM
Dear all, I am calling a store procedure in SQL server 2000 from VS2003 No problem from that side. The store procedure has an input parameter and define as follow : ALTER PROCEDURE sp_GetReels (@LineId varchar) AS SELECT LINE_ID , ID FROM REELHIST WHERE (LINE_ID = @Li...more >>

Can You SQL Inject this code?
Posted by Dixon at 1/19/2006 1:12:11 AM
ALTER PROCEDURE Sp_Login (@username as nvarchar(100),@password as nvarchar(100)) AS select count (*)from Tablename where Username=@username and Password=@password RETURN ...more >>

Unicode encoding problem ?
Posted by Luke at 1/19/2006 12:25:26 AM
Hello ! I need help to resolve some problem. The problem is following: I have the table in MS SQL Db to store xml documents. The xml documents have content (in CDATA section) in plain text with html formating. Content can have text in foregin languages (polish,russian,french). Saving xml docum...more >>

SQL-DMO scripts or something like that
Posted by Enric at 1/19/2006 12:17:02 AM
Dear all, I am pursuing for a script which might be able to dump out to plain file, all the stored procedures, views and so forth. I have been thinking over about sql-dmo object library. By hand is hard and useless. I would like to schedule such task and forget me of it. Could you please...more >>


DevelopmentNow Blog