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 2007 > threads for thursday january 18

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

Applying a unique ID
Posted by Kayda at 1/18/2007 10:36:05 PM
Hi there: What is the most efficient way to apply a unique ID to a table through SQL? I'm working in a SQL Server 2000 DTS package--I have a table that has unique rows but has a null UniqueID field, and I have another table that stored the MaximumLast ID from the master table. I am currently ...more >>

Want to avoid using cursor
Posted by Kayda at 1/18/2007 9:23:01 PM
Hello: Currently I have a large SQL Server 2000 DTS package that does many things--I was able to do everything except one without using cursors. I want to get rid of the one instance I use the cursor however as it holds things up. This is a database that measures events in the life of a pho...more >>

Is this query possible?
Posted by mouac01 NO[at]SPAM yahoo.com at 1/18/2007 5:45:04 PM
I want to sum up the amt field where the acct or group is A1000. Since A1110 belongs to group A1100, and A1100 belongs to group A1000 it should pick those amts up as well. The total should be 600. I have the sql below but I can't figure how to pick up acct A1110 since it should be rolling up t...more >>

Help on Query
Posted by Gavin at 1/18/2007 5:38:33 PM
I am running the following query that will report back the local admins on a workstation, however the string that is pulled from WMI looks like this... \\machine01\root\cimv2:Win32_UserAccount.Domain="machine01",Name="sysadmin121" is there any way that I can get the query to strip off everyth...more >>

Convert Numeric field to Date field
Posted by DorkyGrin at 1/18/2007 5:36:31 PM
I've got a situation where there is Numeric data coming into a program from an older database. The field in question is a numeric field that is returning this: "51217.00" That number represents Dec 17, 2005. Single digit months look like this: 40116.00 indicating Jan 16, 2004. I need to c...more >>

String Manipulation
Posted by Terri at 1/18/2007 5:11:25 PM
Is there any way I can select the quantity out of this data such that I could perform a calculation with it? Thanks. CREATE TABLE #TEST ( TestField varchar (100) ) INSERT INTO #TEST (TestField) VALUES ('Code 1. Qty 130,000. (ID: 1218).') INSERT INTO #TEST (TestField) VALUES ('Code 2. Qty 13...more >>

Are these queries possible without cursors or a while loop?
Posted by tom booster at 1/18/2007 5:02:18 PM
I appreciate any help or advise! Thanks assuming the contents of the table are: 1 52 PUERTO RICO 2 52 PUERTO RICO 3 10 MA 4 52 PUERTO RICO 5 5 NY 6 10 MA 7 5 NY 8 52 PUERTO RICO 9 10 MA 10 11 RI 11 12 PA 12 13 CT 13 14 GA (1) detect if there a...more >>

Identity Column
Posted by Vedran at 1/18/2007 3:14:25 PM
Is it possible to set the indentitiy flag for a column by simply using alter table/alter column in SQL 2000 and SQL 2005. ...more >>



Inner query Question
Posted by Max2006 at 1/18/2007 2:40:33 PM
Hi, In Oracle a query like this works fine: SELECT * FROM ( SELECT * FROM Customer ) However, it does not work in SQL Server. Is there any way to make it work in Sql Server? Thank you, Max ...more >>

Concatenating rows with carriage return
Posted by tyeung168 NO[at]SPAM gmail.com at 1/18/2007 2:34:51 PM
I have a table containing unit and employees assigned Unit Employee 2 North Michael Gates 2 North Bill Jordan 3 South Wendy Shore I want to write a query that will concatenate all the employees that are in the same unit with a carriage r...more >>

Count var number in a table
Posted by Michael at 1/18/2007 2:26:21 PM
Hi, Could you please show me how to count variable number in a table? And, why DESCRIBE procedure is not recognized in SQL server? Thanks a lot! Michael ...more >>

Disregard fields in a Stored Proceedure
Posted by dev648237923 at 1/18/2007 2:15:48 PM
I have a stored proceedure that updates 2 fields. Calling it from C# sometimes I want to update 1 field, sometimes both. My USP has @f1 and @f2 as its arguments. Is there a way to say disregard @f2 if I want I know I can just have two USPs but I'd like to combine it all in one here if possible...more >>

msdb..sp_start_job Launching NOW and getting Instance_Id back for lookup up status
Posted by jobs at 1/18/2007 12:31:03 PM
I have sql server job defined, it currently does not have a schedule defined. In t-sql, how can I launch the job the instantly and get back Instance_Id or something that I can use to check to see if the job is running or finished in a later step? ...more >>

Text column truncating
Posted by raibeart at 1/18/2007 12:05:35 PM
All, I am trying to get a text data field to update in SQL 2000 using a stored procedure. CREATE PROCEDURE [dbo].[sp_SQL_addUpdate] @SQLUpdate_By nvarchar(25), @SQLUpdate_DB nvarchar(15), @SQLUpdate_Object nvarchar(50), @SQLUpdate_Description varchar(8000), @SQLUpdate_Script text, ...more >>

URL get cutoff in SQL
Posted by sweetpotatop NO[at]SPAM yahoo.com at 1/18/2007 11:26:12 AM
Hello I have a job in SQL server, which combines the content of table with URL links and sends the data out via email in html format, however content get a carriage return on every ~900 characters. As a result the URL might get cut off and as a result, it is not working. And here is what I ha...more >>

Best TSQL coding approach
Posted by Cipher at 1/18/2007 10:39:31 AM
Our client currently consolidates information from across more than 100 databases using SQL Server 2005. Their current solution uses a stored procedure to retrieve the data from each database into a single table which Crystal Reports then reports against. The Stored Procedure logic is as f...more >>

Excel-->sql server
Posted by Faffou at 1/18/2007 10:20:42 AM
Hi, i'm new in this field. i have excel file with 70 sheets (all the sheets with the same number and name of column), i 'd to import all this data to a SQL table which have the same column. i know that i can use OpenRowset, but i'm allowed to specify only 1 sheet. Thinks you for you help ...more >>

Distributed Query Problem...
Posted by Carl Wright at 1/18/2007 10:11:58 AM
Dear all I have an issue with a query I am trying to run across two different sql servers. The local server is running 2005 and the remote is running 2000. I need to call a stored procedure on the remote (sql 2000) server from the local (sql 2005) server and populate a table variable. Code is...more >>

Stopping a SQL Query when a particular calculated value is met
Posted by Jeremy at 1/18/2007 10:10:51 AM
I just listed a post to find out how to rank a table formatted like the one below in such a way that people who have the same points will be ranked in the same position (a tie). Full_Name Points ----------------- ------------ Name1 855 Name2 805 ...more >>

Finding offending rows in a self relating table
Posted by Robert Bravery at 1/18/2007 9:46:51 AM
HI, I have inherited a table that has a self join in it. A column called "Parent" is related to the PK of the same table. Problem is, I think, that when the relation was created, it was never asked to check current rows, now I find a contraint conflict when I try to correct the oversight. My ...more >>

The hierarchical join -- solution
Posted by Alan Samet at 1/18/2007 9:28:56 AM
A few years back I thought of a SQL problem related to performing joins up a hierarchy; last summer I spent an afternoon solving it. It's not doing me any good sitting on my hard drive, so I've decided to share my solution. This is a very common problem in business development. Here is an exampl...more >>

Query which calculates a field value based on previous row's values
Posted by Jeremy at 1/18/2007 9:18:12 AM
I need to write a t-sql query that will take the value of the previous record into consideration before calculating the current row's new column value... Here's the situation... I have a query which return the following table structure... Full_Name Points ----------------- ...more >>

Problem with my modelisation
Posted by ina at 1/18/2007 8:25:51 AM
Hello Guys, I have a question: I would like to build a flexible question tool. These are the main tables for the moment. /*This table is question table; Question ID, The kind of answer (Text, integer or list), QuestionType (this is for script), Question Text) CREATE TABLE [dbo].[QUEST...more >>

Slicing database by company_id colum
Posted by masalerno NO[at]SPAM gmail.com at 1/18/2007 7:28:32 AM
Hi, I have a SQL Server 2005 db with 60 tables related to customers, orders, payments, etc Now I need to add a COMPANY columns to all tables, as the same database will be accessed by customers from different companies. I want the Customers of COMPANY A to select, insert, update only the rec...more >>

Pull Last Record from Table
Posted by Glenn Billand at 1/18/2007 7:19:48 AM
Hi, I am trying to modify the following query which currently pulls records based on max date. I'd actually like to change this so it no longer pulls by max date but rather than the most recent record entered into the table. The current query is as follows: SELECT ll.sDisplay, t.sLastName...more >>

Total sum field with PIVOT?
Posted by staeri NO[at]SPAM gmail.com at 1/18/2007 7:09:50 AM
I have the following query which shows the quantity sum for each week: SELECT ProductID, Description, Quality, ProductGroupID, [1] AS W1, [2] AS W2, [3] AS W3, [4] AS W4, [5] AS W5 FROM (SELECT ProductID, Description, Quality, ProductGroupID, DeliveryWeek, Quantity FROM vwProduct_order WHERE...more >>

Function to find the max of two dates (SQL2K)
Posted by hals_left at 1/18/2007 4:49:19 AM
Hi I need a query to report compliance with a 30 working day KPI of depatched items. That is how long after receipt of a key piece of info the despatch is made. To make matters even more complex, to make a despatch we actually need two pieces of info, and these may arrive before/after each other...more >>

How can i select data from a table with a custom span of record number
Posted by munnacs NO[at]SPAM gmail.com at 1/18/2007 3:07:22 AM
Hi, Is there any way to select some data with a custom span of record number... Lets say a sql qurry return 1000 data ... and i want to get only 200 to 500 record numbers... Just like "TOP" operator which define a records size from top of the querry.... Thanks for any help in advance M...more >>

executing console application to create excel from database
Posted by Senthil at 1/18/2007 2:48:17 AM
Hi all I created a C# console application that is called through a stored procedure using xp_cmdshell. The application generates an Excel report from the database with a macro embedded in it. The report generation fails when it is through xp_cmdshell. But when I tried to run the execut...more >>

beginning SQL server 2005?? [C# .NET 2.0]
Posted by giddy at 1/18/2007 2:13:30 AM
hi , i'm a C# programmer , i've decided to upgrade my app from using ms access to SQL server 2005 EXPRESS. (i cant BUY the FULL!) So where do i begin , i need a brief but complete article/ book/ sample.. . on the basics : 1. connecting to it 2. making tables , edit them , delete them etc ...more >>

Sql server to Excel DTS problem
Posted by ads at 1/18/2007 12:21:03 AM
I tried creating a DTS job that will export data from sqlserver to excel using the export wizard. i choose the option execute the job then schedule it. Executing the job (for the first time) works fine but executing it based on schedule or force executing it causes an error: The Microsoft Jet ...more >>


DevelopmentNow Blog