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 > october 2007 > threads for wednesday october 17

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

@@Error not behaving as expected.
Posted by Doogie at 10/17/2007 11:21:16 PM
Hello, I am running into a situation where inside one stored proc I am executing another. If the 2nd proc errors, there is an update in the first proc that I do NOT want to execute. So I have code like this: EXEC MyProcName @Parameter1, @Parameter2 IF (@@ERROR = 0) BEGIN UPDATE...more >>

Design for performance --please suggest
Posted by loufuki NO[at]SPAM gmail.com at 10/17/2007 10:27:24 PM
Hi I have a table T1 that needed to go into server DW (DataWarehouse). However, It will be used in server Staging for other pursposes and will be deleted after that.. I have a two options to do this but don't know exactly which one is better. 1. Only copy to DW and use it in Staging 2 ...more >>

opinions on using Hibernate with sql server
Posted by Derek at 10/17/2007 8:23:14 PM
i am researching hibernate as a layer to my sql server 2005 database. is anyone out there using it with sql server now? anyone have an opinion on using hibernate? bad idea? does it perform and scale? does it handle stored procedure resultsets well? ...more >>

Design/optimization advice?
Posted by erpeters NO[at]SPAM gmail.com at 10/17/2007 7:28:47 PM
Hi all- I have a schema that is mostly working, but I was wondering if some of you with more experience than I might give me some constructive criticism on my methodology. Basically, I have a single table that stores data for many records. Each record has a variable number of fields, each...more >>

Multiple use of inner join
Posted by Ana at 10/17/2007 7:10:40 PM
Hi, In a query I'm using a multiple transactional INNER JOIN (sub queries - about 8 of them). Ex. Select * From (Select .. From.) a inner join on . ........ (Select...) g on .. All works well except when one of the subqueries results is zero. When it happens, the entire ...more >>

Clustered primary key
Posted by shapper at 10/17/2007 6:09:40 PM
Hi, What is the difference between: create table dbo.Users ( UserID uniqueidentifier not null constraint PK_User primary key, Email nvarchar(200) null, .... and create table dbo.Users ( UserID uniqueidentifier not null constraint PK_User primary key CLUSTERED, Email nvarc...more >>

Trigger, how to regconize inserted, delete or updated?
Posted by Nhan at 10/17/2007 5:02:04 PM
H, I need help. I have SQL Server 2000 I want to write a trigger on table Test_table for INSERT, DELETE and UPDATE. (together in a trigger). Which function or keyword can tell me, what event occurs (inserting, deleting or updating)? Thanks Nhan ...more >>

Join with criteria - what is first?
Posted by Vik at 10/17/2007 4:24:34 PM
SQL Server 2000: Table: T1 | T2 Field: F1 | F2 F3 Values: 1 1 A 2 2 B 3 3 NULL 4 View1: ...more >>



Timeout error..?
Posted by Chubbly Geezer at 10/17/2007 3:47:55 PM
I am running the below script in management studio but it continually = returns the message "Timeout expired. The timeout period elapsed prior = to completion of the operation or the server is not responding." I have c.5 1/2 million records. Any ideas please. INSERT INTO DEVSERVER.isl_mscr...more >>

what are sessions
Posted by deepak at 10/17/2007 2:48:49 PM
Hi There, could anybody please explain me what are session in the context of sqlserver 2005 Regards Deepak ...more >>

CASE statement in WHERE clause
Posted by shank at 10/17/2007 2:22:46 PM
I see samples of using the CASE statement in the WHERE clause, but it's limited to one or two conditions. What if there's many conditions? I tried different variations and get syntax errors. What is wrong with my attempt below? It's a morph attempt from an ORDER BY clause using CASE example. ...more >>

file parsing function
Posted by JTL at 10/17/2007 1:35:27 PM
anyone know of a good sql server function/script to parse a text file that is stored in sql server as a single column/single row nvarchar(max) datatype? the resultset should return each line of the file on its own row. tia jt ...more >>

Assign Sequence Number in Procedure or Trigger
Posted by Joshua A. Booker at 10/17/2007 1:29:29 PM
Hi there, Is it possible to assign a sequence number to a field in an INSERT INTO statement? Or after the insert, how would I begin to use T-SQL to increment a numeric field. Similar to the Identity Function for use with a SELECT INTO statement, I want to step through a table and incremen...more >>

SQL 2000 Agent jobs in a non-domain environment
Posted by DWalker at 10/17/2007 12:55:54 PM
I posted this in the setup ng and didn't get anything yet. Maybe someone here knows the answer! I had to rebuild my SQL development computer, which runs XP Pro, and is not a domain controller or a member of a domain. I have SQL 2000 server (SP4) and SQL 2005 server on this development ...more >>

SQL Server 2000 Subquery
Posted by SJ at 10/17/2007 12:52:03 PM
I have 2 tables #temp1 & #temp2 - both have 3 fields in common company_id char(9), dept_id int , soc_sec_# char(9) These 3 fields are differnet ids for an employee - they are unique to the employee. One employee could have just the company_id, one could have just the soc_sec_3 and one may...more >>

Bcp problem (2005)
Posted by Mike C# at 10/17/2007 12:39:15 PM
Having an issue with bcp on 2005, but brain is fried today for some reason. Any help appreciated. Here's the deal: I have an XML format file like this: <RECORD> <FIELD ID="1" xsi:type="CharTerm" TERMINATOR="|" MAX_LENGTH="50" COLLATION="Latin1_General_CI_AS"/> <FIELD ID="2" xsi:type...more >>

Capturing the sucess/failure of a backup
Posted by Jay at 10/17/2007 12:15:11 PM
SQL Server 2000 (mostly) I have a backup script I've been using for some time (based on the one from realsqlguy.blogspot.com) that I've just found a problem with. I don't seem to have the ability to tell if the backup was succussful, or if it failed from inside the T-SQL script. The oper...more >>

How do I know if a trigger is enabled?
Posted by DBA at 10/17/2007 11:41:04 AM
I have SQL 2000 Sp3A. is there a t-sql command that I can run to find out if a trigger has been enabled or disabled?...more >>

Convert int to newid (GUID)
Posted by agenda9533 at 10/17/2007 11:36:02 AM
I have a unique field ticket_number(int). I have historical data in this field (46000 records). Is there any safe way to change integer(4) datatipe to newid and not affect historical data. thanks much...more >>

XML Load
Posted by mvp at 10/17/2007 11:35:00 AM
Hello EveryBody, I have xml document which i want to load into table using DTS and Activex Script. <?xml version="1.0" encoding="UTF-8" ?> <Id>2433165</Id> <CreateDate>2007-10-07 08:49:18.0</CreateDate> <ProfileSource>WebSite</ProfileSource> <InterviewSet>Staff Registered...more >>

Select data for this month
Posted by Rem-8 at 10/17/2007 11:32:24 AM
Hello. I'm not good at sql scripting, but I need to do a select on a table which needs to gather data from whole existing month. And whenever sql will be run, select has to collect data from 1st to n-th day of this month. Is it possible to do it with one query? Cheers. ...more >>

Generating unique contract numbers
Posted by Ronald S. Cook at 10/17/2007 11:23:26 AM
We have several feedyards across the U.S. Each needs to create contracts throughout the day. The contract numbers must be unique throughout the whole company. Our first thought was for the feedyard to hit a single corporate database and get the next number. However, Internet lines betwee...more >>

constraint that enforces only one of two fields must be filled in
Posted by Tracey at 10/17/2007 11:07:00 AM
is there a way to enforce that one or the other field on a table is filled in, and not both or neither? eg table SUBJECTSNAME Primary Key LastName (with FK to NameList table) Company (with a FK to CompanyList table) LastName or Company needs to have a entry, but not both or neither. I...more >>

String with carriage return
Posted by huohaodian NO[at]SPAM gmail.com at 10/17/2007 10:10:22 AM
How can I make a multiple line string? I am trying to use string to write info into a log file. how can I make a string that with multiple line that can be written into the file. For example deaclare @str varchar(300) set @str = N'aa' + ?? set @str = @str + N'bb' so that @str = a...more >>

String with carriage return
Posted by huohaodian NO[at]SPAM gmail.com at 10/17/2007 9:42:41 AM
How can I make a multiple line string? I am trying to use string to write info into a log file. how can I make a string that with multiple line that can be written into the file. For example deaclare @str varchar(300) set @str = N'aa' + ?? set @str = @str + N'bb' so that @str = a...more >>

String with carriage return
Posted by huohaodian NO[at]SPAM gmail.com at 10/17/2007 9:36:32 AM
How can I make a multiple line string? I am trying to use string to write info into a log file. how can I make a string that with multiple line that can be written into the file. For example deaclare @str varchar(300) set @str = N'aa' + ?? set @str = @str + N'bb' so that @str = a...more >>

referencing returned table
Posted by at 10/17/2007 9:03:51 AM
I'm sure this is simple, but how do I refer to a table returned by a function? I have a function that returns a single row with 5 columns of integers. If I do a select * from myFunction(p1,p2) in a QA window, the results are displayed fine. In my procedure, I know I get a table returned, but...more >>

How to know the user ,who is executing the query
Posted by deepak at 10/17/2007 8:51:06 AM
Hi There, I have a requirement of knowing the user who is executing a query/ stroed proc.let me be more clear: lets say ,we have an application which connects to the sql server and invokes some stored procs(say SP_Temp) on that.now in my Sp_Temp i need to have a T-sql statement which finds ...more >>

Call Web Service from SQL Server 2005 Stored Procedure
Posted by parchk at 10/17/2007 8:16:00 AM
Is it possible to call a web service from a stored procedure? We are looking to access google maps' web service to obtain latitude and longitude values for addresses to calculate more accurate distance calculations. Thanks in advance....more >>

move table changes but not lose data
Posted by Mike at 10/17/2007 7:27:47 AM
I have to migrate several db tables that have been changed to our QA = environment but the tables on our QA database has data. Is there a way = to move the table changes from our test database server to our qa = database server without losing the data in the qa database? I only want to move th...more >>

Recursion for Scalar- Valued Function
Posted by Michael Eubanks at 10/17/2007 7:13:01 AM
I am trying to create a function that is recursive but when I execute the create, I recieve an error that UOMRootMult does not exists. I know I could probobly implment this a a stored procedure but I would prefer a function if possible. I am new to MS SQL Server and I am using the 2005 versio...more >>

A suitable SQL Server book for my goals
Posted by Mukesh_Singh_Nick NO[at]SPAM yahoo.com at 10/17/2007 7:06:47 AM
What's the best book to buy for learning MS-SQL Server for a database programmer. I'll tell you my goals. I want a book that covers: 1) the theory behind operators (cartesian JOIN, cross JOIN, all the JOINs, UNION, UNION all) and their comparison to mathematics/set theory 2) writing complex...more >>

What are these queries used for?
Posted by Mukesh_Singh_Nick NO[at]SPAM yahoo.com at 10/17/2007 7:05:34 AM
I've come accross queries like this one previously but never got the time to carefully study them form some book. SELECT 1 WHERE 1 = 1 1) What do queries like these mean? From common sense, I can deduce that it is some kind of a test for a boolean value, but the result is already determin...more >>

Multiple Queries / One dataset
Posted by BLAW at 10/17/2007 7:03:30 AM
THE 1ST COLUMN (MONTH) IS A SIMPLY MONTH FORMATTING, ALL Conracts that EXPIRE 2 YEARS FROM THeir creation DATE, TO GET THE 3RD COLUMN (CONTRACTS DUE) I DID A DATEADD TO THE CREATION DATE (ALL CONTRACTS EXPIRE EVERY 2 YEARS FROM CREATION DATE), A GROUP BY AND A COUNT OF THE CONTRACT ID'S. THE 2ND...more >>

Many to Many relationships
Posted by shapper at 10/17/2007 3:32:02 AM
Hello, I have 3 tables. Posts, PostsTags and Tags. This is a many to many relationship. So PostsTags has the following columns: PostId (PK) and TagId (PK) I always did that way in SQL 2005. In some examples I see PostsTags have 3 columns: PostTagId(PK), PostId (FK), TagId (FK) Shou...more >>

Management Studio - Open From Source Control
Posted by Stig at 10/17/2007 3:09:04 AM
SQL Server Documentation states that you can open a solution or project file from source control by File->Source Control->Open from Source Control. However this command is not available in SQL Server Management Studio on several of our machines. I tried using Customize to add this command to ...more >>

Problem with one to many query
Posted by Mark at 10/17/2007 2:02:09 AM
Hi - I have 2 tables, with a one to many relationship. The first table Agents is a list of agents in our call centre - the second, Agent_History is a list of changes to those agents, each of which is time stamped - eg. agent created, agent moved desk, agent given new telephone number. I woul...more >>

Date time difference !!
Posted by calderara at 10/17/2007 12:26:01 AM
Dear all, I have a table in which I collect different events. 2 of those records fields are OnTime and OffTime DateTime which informed when event goes On and Off. From this set of records, i will like to apply an agregate function which return the duration for events. Duration will be...more >>

Help with SQL
Posted by Jerry at 10/17/2007 12:00:00 AM
My goal is this: if I'm looking at the information for a specific group there should be a list of contacts that do not have records for this group so they can be added. If I am looking at the information for groupID 58 my list should include Allen, Bob and John, Mary. Everything I've tried so fa...more >>

Set Based Solution
Posted by Paul Ilacqua at 10/17/2007 12:00:00 AM
Here is my issue.....This is data generated from a Data Collection System....and there are times a "unit Bar Code" is rejected for multiple reject codes. If you notice the DT column... sometimes there is a time lag between tests with the same unit. Is there way in a set based SQL call to dis...more >>

Problem Saving Script from Management Studio as Text
Posted by John Kotuby at 10/17/2007 12:00:00 AM
Hi everyone, I am having a problem in SQL Server 2005 Management Studio creating a script, for example (create table) from an existing table and saving it so that it opens as text in a text editor of my choice. For example I right-click on a table in the Object Explorer and select "Script Ta...more >>

SQL Server 2000 Database BackUp question
Posted by Jason Huang at 10/17/2007 12:00:00 AM
Hi, In my SQL Server 2000, I have approximately 40 databases. If I go to the wizard, then I'll have to do it 40 times. Is there any convient way for backuping these 40 databases? Thanks for help. Jason ...more >>


DevelopmentNow Blog