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
August 2008
all groups > sql server programming > july 2007 > threads for monday july 2

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

Updating a row using cursor
Posted by bubbles at 7/2/2007 11:34:29 PM
I have a small table with the following type of sorted data: ColumnA ======= FEN_COR FEN_COX FEN_COZ RKD_MMO RKD_MPE This table is generated at every batch run, so the data is dynamic. Problem: ======= I Need to generate another column by taking the first three chars, and add a two...more >>


How To Script Out SQL Server 2005 Maintenance Plans?
Posted by Vince Castellano at 7/2/2007 10:06:28 PM
Hello, I am using SMO to create a version control system for table structure, views, and stored procs/udf's, but one other server side object I would like to script out and store is the Maintenance Plans in SQL Server 2005. I have found the information in msdb.dbo.sysmaintplan_*, but they jus...more >>

Pseudo Identity Column needed...
Posted by Jonni Lazzerini at 7/2/2007 8:36:29 PM
Hi, I need a "pseudo identity column" on a Table and I'm thinking what's the better way to get it. What I mean is an almost always automatically generated unique key on new records with some user intervention possibility on choosing it. I've tought a solution, but I would ask you if is it poss...more >>

how to check if a database is online and also Ready to query
Posted by newToSql at 7/2/2007 5:28:16 PM
Hi, I am asking this question again, I need to determine if a database is online (which is easy from sys.databases) and ready to query. I need to run such check on several databases on several servers. Any ideas? thanks ...more >>

An other query Q:
Posted by AnaT at 7/2/2007 5:16:50 PM
Hi, I've a table (Policy) with the following fields: pol_ID, pol_no, pol_start_date, pol_end_date, pol_cost. The duration of a policy could be from 6 months to 4 years. If a 3 year policy is sold today, I need to find out its monthly cost for its duration of 36 months (cost/36). ...more >>

"Run-time error '-2147467259 + very urgent
Posted by maslooki at 7/2/2007 5:14:01 PM
Dear All, Please help me I have problem with SQL Database when I open the RoutPro software for upload some file to Database I show this error:- "Run-time error '-2147467259 (80004005) Transaction (Process ID 86) was deadlocked on lock resources with another process and has been chosen...more >>

FOR UPDATE trigger error on creation
Posted by jtertin at 7/2/2007 3:08:07 PM
I am trying to create a trigger that will replace NULL values of a field to a single space (' '). The following is what I have so far. For some reason when I try and create the trigger, I get a syntax error near @Code on the last line. I know it is not that line as it runs fine when executed a...more >>

First value in a field
Posted by David at 7/2/2007 1:36:01 PM
I need to be able to return the first record in a specified field. I have read that this was possible using Access but not in SQL Server. What is the equivalent function that I can use in SQL Server? I want to do something like: select name, first(PhoneNumber) as FirstPhoneNumberinList ...more >>



Problem Writing to Excel
Posted by doofy at 7/2/2007 1:12:18 PM
I've got an application where I send the contents of a SS table to a worksheet in Excel, then save the XL file to a new name, and then email it out. Everything seems to be working, except that when I port the table info into XL, it keeps appending new info down at the bottom of existing i...more >>

Convert select output to a string
Posted by Xavier at 7/2/2007 12:18:01 PM
Hi, I want to convert the output of a select on a table to a string. Example SELECT Countries from articles where articleId=333 UK DE AT in something like UK,DE,AT Thanks...more >>

T-SQL Script to insert many records into DB Table
Posted by Que at 7/2/2007 11:55:58 AM
Hi I need to create a Stored procedure or a SQL Script that has a loop to insert 10 Million Records into a Database Table the Values are Columns 1 - Key Columns 2 - Hello Columns 3 - World Column 1 is the only column that needs to be changed in every Insert as this is the Key....more >>

Problem connecting to sql server
Posted by Jack at 7/2/2007 11:36:00 AM
Hi, I am using the following connection string from Access vba to call stored procedure. However, there is error in the connection. When I am checking the same connection from the control Panel using dsn, the connection shows success. I would appreciate if someone can tell me what's wrong wit...more >>

Problem with UPDATE statement
Posted by Roger Denison at 7/2/2007 10:46:05 AM
I have a table (tblTable) with data types as follows: ColumnA int ColumnB char(5) ColumnC bit Now I want to use an UPDATE statement in a stored procedure such that: Update tblTable Set ColumnC = 1 Where ColumnA = null AND ColumnB = '' (tick-tick) However, for a particular record I cann...more >>

Detecting scema changes / auditing
Posted by Naveen at 7/2/2007 9:26:06 AM
Hi, Is it possible to detect database schema changes on a SQL Server 2005 database without having to run change scripts (like some of the RedGate tools) etc.? I would be interested in knowing the schema change that occurred and the user who made the change. Thanks, Naveen ...more >>

NULL values, '', tick-tick, best practice
Posted by Terri at 7/2/2007 9:04:26 AM
I have a vendor that inserts '', (that's 2 single quotes) into varchar fields when the field has no data. They call this tick-tick. I am not familiar with this design strategy. I am used to using coalesce and am naturally getting unexpected results. Does ANSI have anything to say about this? ...more >>

count on 8 million rows
Posted by shanky at 7/2/2007 8:58:00 AM
Is there a way to just count like 200 rows...instead of doing count on 8 million records....count is taking 2-3 minutes....I am doing count on 8 million rows with where clause... select @Rec_Cnt = count(Customer_Id) FROM products with (nolock) WHERE product1 like COALESCE(@product1, pr...more >>

Can't create trigger - Help !
Posted by Bill Yanaire at 7/2/2007 8:42:35 AM
I tried to create the following trigger (SQL 2005) and received an error: Msg 2714, Level 16, State 2, Procedure ProductAudit, Line 5 There is already an object named 'ProductAudit' in the database. I used the following code to create the trigger: CREATE TRIGGER ProductAudit ON Productio...more >>

Help - thousands of locks on a db
Posted by katproductions at 7/2/2007 7:58:44 AM
I have a system that uses SQL Server 2000 running on WIN 2003 Server. It seems to run fine under heavy load for 2-3 days then all of a sudden it grinds to a halt. Looking at the syslockinfo table shows several thousand locks on the database, mostly involving two tables, but with a sprinkling o...more >>

Where can I download data from
Posted by rich at 7/2/2007 7:58:00 AM
Hello, As part of teaching myself SQL Server, I am attempting to develop a database for tracking various stock/financial related information for public companies (NYSE and NASDAQ). Can anyone point me to a source where I can freely download the company name and stock symbol for all compa...more >>

Need a script to populate database tables
Posted by rich at 7/2/2007 7:52:02 AM
Hello, I am somewhat of a SQL newbie and need a little help. I would like to populate a simple test database (table). The table has the following few columns: 1. Value numeric 2. Cr8time date/time I would like to be able to script the following functionality:...more >>

Problems Creating new records by using stored procedures
Posted by fuka at 7/2/2007 6:45:54 AM
Hi, I use the following Code for Creating new Records in a table by a stored proc: SET @sql3 = 'INSERT INTO ' + quotename(@tblname) + ' (ID_W, ID_Kd, DSNr, txtNr, txtJahr) SELECT @ID_W, @ID_KD, @DSNr, MAX(' + quotename(@tblname) + '.txtNr)+1 FROM ' ...more >>

About generating serial number within another field
Posted by Deva at 7/2/2007 4:12:03 AM
Hi, I have a requirement, where, I want to generate a serial number within a date value. I cannot use identity field for this. I have provided below the table creation script and sample data. create table Gen_Serial (LoadDate SmallDateTime, SerialNum int, Data int) insert into Gen_...more >>

<newbie> copying database, how?
Posted by Jeff at 7/2/2007 12:19:46 AM
I've just installed the evaulation copy of Sql Server 2005 on my computer (winXP pro + sp2). I'm wondering how I can create a new database based on an existing database on the same server. Sql Server 2005 installed a demo database, how can I create a copy of this database (this copy will b...more >>

Counting duplicate entries
Posted by Greg Smith at 7/2/2007 12:00:00 AM
Is it possible to write a query that will give me the count of records that contain duplicate information in a given field? i.e. the Lastname field, yielding something like this: Smith 17 Jones 16 Olson 10 ..... Any help is greatly appreciated. ...more >>


DevelopmentNow Blog