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 2007 > threads for monday april 16

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

select ntext with length greater than 8000
Posted by czl1129 NO[at]SPAM gmail.com at 4/16/2007 9:54:45 PM
Maybe I'm missing something here. It seems what I'm trying to do is pretty simple. I'm trying to query a database field with data type ntext, and the content is greater than 8000 in length. I'm using .NET 1.1 framework to run a query. SqlCommand cmd = new SqlCommand("SELECT message_body from t...more >>


Importing Fixed Length Strings
Posted by Leila at 4/16/2007 9:46:32 PM
Hi, I have a text file but its content is not delimited. For example I know that first 4 characters are my first column, next 3 characters are second column and so on. What's the fastest way to import such files into a table? My files are very large and the speed is important. Any help will...more >>

Update column with an IDnumber
Posted by Titten Tei at 4/16/2007 9:44:42 PM
I need to add a special ID to each row in a column in several tables of my database. The counter has a prefix of 3 characters ABC + a number. Ex. ABC000000001 I've allready built a query to get all the tables that I would like to update. gives me the result: ex. TABLE1 TABLE2 TABLE3 ...more >>

2005: newbie has problem with semicolon
Posted by R.A.M. at 4/16/2007 9:19:12 PM
I have one more question ;-). In the code below I have error: Msg 102, Level 15, State 1, Procedure AfterInsertMaterials, Line 11 Incorrect syntax near ';'. I don't know what is wrong. Table MaterialsInStocks has 6 columns. By the way (I am newbie), use semicolons generally or not? If I r...more >>

2005: usage of transaction in instead-of trigger
Posted by R.A.M. at 4/16/2007 8:28:12 PM
Hello, (Sorry for my English...) I am learning T-SQL and I would like to know if what I wrote makes sense. I wrote a INSTEAD OF trigger with TRANSACTION. In my material stock database application when new position of material document is created I need to update total quantity/value of material...more >>

Message to JOE CELKO
Posted by vxc699d at 4/16/2007 7:50:12 PM
Stop being a prick. You spoil the genial atmosphere of this newsgroup with your ill-mannered rants at people over petty issues. And your supposed intellectual arrogance is unfounded - sometimes, you are just plain wrong in your assertions. No-one likes you. So please either shut up and...more >>

changing a Primary key value
Posted by Ant at 4/16/2007 6:50:02 PM
Hi, I'm uggh, trying to change a Primary key value that was incorrectly added & must be changed to the next available generated key value. The trouble is, there are many related tables. If I try to change the PK for tbl1 I get a constraint error on tbl2. If I try to vhange it on tbl2 I ...more >>

Select into temporary table does not work
Posted by Tore at 4/16/2007 6:39:32 PM
I run SQL Server 2000, latest servicepack. My problem is that Select into tablename does not work when tablename is a temporary table. It works perfectly when tablename is a permanent table. I have a complicated stored procedure handling pivoting with a random number of columns a...more >>



Error
Posted by FARRUKH at 4/16/2007 6:18:00 PM
I am getting this error daily and can not find the solutuon. ERROR: 15457, SEVERITY: 0, STATE : 1 CONFIGURATION option 'show advanced options' changed from 1 to 1. Run the Reconfigure statement to install Anyone has an idea? how to solve this error...more >>

Weird Case Behavior in WHERE Clause
Posted by Dan at 4/16/2007 3:21:41 PM
Below is the WHERE clause that returns records whose date is the last business day of the previous month and the current date. The strange thing is I have to subtract 2 days from Saturday to get 3/30/07 when DATEADD(day, (0 - datepart(dd,getdate())), getdate()) returns 3/31/07. Can anyone e...more >>

Changing column to Identity
Posted by David C at 4/16/2007 3:12:57 PM
I have a SQL 2000 database that has a pretty large table with an Integer column as a Primary Key. I want to make it an Identity column as I now assign next highest number on inserts. I tried changing it on a test database using EM and it seemed to change ok. I also did an insert and it pi...more >>

Multiple result sets?
Posted by zz12 at 4/16/2007 3:03:32 PM
Hello. I was wondering if anyone knew if it's possible or how would I approach importing 2 sets of data that is returned when running a stored procedure that comes from a different sql server 2k machine into a table on our local sql server 2k machine? One result set of data to import is pret...more >>

How to terminate Sys Process?
Posted by Michael Kansky at 4/16/2007 2:51:58 PM
I have a suspended process that sits in running processes returned by SP_WHO for 3 days already. SPID:10 Status: SUSPENDED Login Name: sa DB NAME: master Command:CHECKPOINT CPU Time: 2625937 DiskIO: 358622 An attempt to "kill 10 " failed saying that only user processes can be kille...more >>

Extract 1st element from a set
Posted by Ankit Dave at 4/16/2007 2:25:42 PM
Hi I have a stored procedure which takes input as create or replace procedure #temp @parameter varchar(50), --- containts like ( '4', '334' , '33') .. kind of a set. @para_count int @para_1 int, begin -- some work -- End I want to extract the 1st element from the @par...more >>

Search for key string in SP,View,etc... in all user databases
Posted by gv at 4/16/2007 2:20:34 PM
Ok I'm trying to loop through all the databases except for system databases for key word in SP,Views,etc... Well when I run it in query analyzer and based on what databases I choose from the drop down, I will get different results? I'm going through each database and loading the @dbName corret...more >>

Reference books for beginners
Posted by David Armstrong at 4/16/2007 1:38:01 PM
Hello all, I am interested in developing an application using SQL Server. I have some rudimentary exposure to Access, VB .Net and ADO/DAO. I am looking for a book that deals with developing the user interface and tying it to the backend database. I already have a good grasp on database d...more >>

Database design
Posted by Esteban Yanson at 4/16/2007 1:30:01 PM
We has two different opinions about how use PKs in some tables. I need know what of this options are correct. Thaks !!! *** OPTION 1 *** Countries: (PK) CountryId Name States: (PK) CountrId (PK) StateId Name Surface Cities: (PK) CountryId (PK) StateId (PK) CityId Name **...more >>

multiple users overlapping transactions
Posted by rich at 4/16/2007 12:45:37 PM
I have a fairly simple VB program that loads data into a parent and child table. For each parent, there can be as few as 5 to 10 rows or as many as a couple of hundred. I'm invoking an ADO connection object to start the transaction, perform the insert into the parent followed by the several inse...more >>

TDS Stream Error
Posted by sriram at 4/16/2007 11:51:48 AM
Hi All, Not exactly sure if this post would be suitable for this group. While processing my analysis services cubes using partitionprocess.exe.....i am getting an error these days..."Protocol error in TDS stream (#-2147467259;Microsoft OLE DB Provider for SQL Server)"......Could some body tel...more >>

How can I get the structure (Column Name, Data Type, Nullable, Identity, etc...) of all the tables/views
Posted by Matthew at 4/16/2007 11:48:46 AM
How can I get the structure (Column Name, Data Type, Nullable, Identity, etc...) of all the tables/views from a database. What I want to accomplish is to set up an audit system so I can know when someone modify a table, and track it back to what was changed. I found these but I need more infor...more >>

XML: SQL2000 vs SQL2005
Posted by Sunil K at 4/16/2007 11:46:15 AM
Working with XML documents, are there substantial enhancements in SQL2005 as compared to SQL2000? If this is a new project, why would it better to use SQL2005? Any suggestions would be appreciated. -- Thanks in advance - Sunil. ...more >>

SQLCMD batch file not closing
Posted by esebastian NO[at]SPAM esolutionsgroup.ca at 4/16/2007 10:53:16 AM
Hi All, Probably an easy answer to this.. I have written a batch file that runs a stored procedure.. here is what's written in the batch. SQLCMD -q"Exec BACKUPDATABASE" -SWAT19714 -dOCHC2 this works fine however the command window will not close after the batch file has been executed.. her...more >>

Partitioning
Posted by CLM at 4/16/2007 10:00:04 AM
We're completely 2000 right now but need to implement partitioning when we go to 2005 in a few months on a few of our large tables. I've been reading through the information on such statements as ALTER PARTITION SCHEME... ALTER PARTITION FUNCTION... ALTER INDEX Indexname ON Tablename REBU...more >>

select the last 5 comments for each id
Posted by culam at 4/16/2007 9:44:01 AM
I have a comments table for all customers. I would like to only select the lastest 3 comments for each CustID. Please help! Thanks in Advance, culam CustID comment dateandtime ------ -------------- ----------------------- 9859 Welcome L 2006-01-30 13:06:40.000 9859 Info P...more >>

2003
Posted by CLM at 4/16/2007 9:10:09 AM
I wanted to ask this one more time: Our servers are all SS 2000 SP4 sitting on top of Win 2000 SP4. The other day I was in a meeting with our JDE administrator and he made the comment that when we go to Windows Server 2003, we'll get a "30% performance improvement". Of course, that's a vagu...more >>

stored procedure results into #temp?
Posted by HockeyFan at 4/16/2007 9:03:34 AM
I've written 2 stored procedures that pull from different databases and tables, but I made sure are returning data fields named the same and with the same data types. I'd like to have another stored procedure that invokes one of these stored procedures and puts it's resultset into #temp1, and th...more >>

BCP and Divide By Zero
Posted by Hitesh at 4/16/2007 8:54:40 AM
CREATE PROC test_proc AS DECLARE @num1 float DECLARE @num2 float DECLARE @num3 float SET @num1 = 4.0 SET @num2 = 0.0 IF @num2 > 0 BEGIN SET @num3 = @num1/@num2 END SELECT @num3 When I execute above stored procedure using QA or OSQL, I get output NULL but when I execute this procedu...more >>

BCP and Divide By Zero
Posted by Hitesh at 4/16/2007 8:54:11 AM
CREATE PROC test_proc AS DECLARE @num1 float DECLARE @num2 float DECLARE @num3 float SET @num1 = 4.0 SET @num2 = 0.0 IF @num2 > 0 BEGIN SET @num3 = @num1/@num2 END SELECT @num3 When I execute above stored procedure using QA or OSQL, I get output NULL but when I execute this procedu...more >>

remove duplicate char in the string
Posted by gsganesh at 4/16/2007 8:22:29 AM
Hi There, How to remove duplicates character from a string, for e.g i've a string abccdedgh@@@@@@@test.comco now i need output like this abcdedgh@ts.om Thanks Ganesh ...more >>

Executing SQL from file
Posted by Luke at 4/16/2007 8:10:02 AM
I want to be able to run a .sql file from a stored procedure or function. My intent is to automate the creation of views and tables based on a user input. I am fairly sure that I can do this just by exposing the SQL in the stored procedure, but this means having the same code in multiple places...more >>

Triggers has compiled execution plan?
Posted by Artificer at 4/16/2007 6:46:19 AM
I know that stored procedures are fast because on first execution they create an execution plan and stored it. Do trigger has the same behavior? ...more >>

Error
Posted by FARRUKH at 4/16/2007 6:20:02 AM
BACKUP failed to complete the command BACKUP DATABASE [SMS_A21] TO DISK = N'e:\MSSQL\BACKUP\SMS_A21\SMS_A21_db_200704150200.BAK' WITH INIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT this is the first time i see this error. what does it mean? there is a space n drive also any advic...more >>

Third Highest Salary
Posted by escortsoftwares NO[at]SPAM gmail.com at 4/16/2007 5:18:21 AM
Hi, 'Employee' Table is referred as 'table1' 'Third Highest' is expressed as 'TOP 3' (For second highest 'TOP 2') SELECT MIN(a.Salary) FROM table1 a WHERE a.Salary IN (SELECT TOP 3 b.Salary FROM table1 b ORDER BY b.Salary DESC) ...more >>

How to display only one result set from a stored procedure
Posted by veeranjaneyulu at 4/16/2007 5:10:06 AM
Hi sir/madam, Here I have one stored procedure. When I executed that stored procedure it's giving 10 result sets (in that stored procedure 10 select statements there. For example select * from tablename with out writting any where condition and so on.). Here the requirement is how I get on...more >>

Sequence of columns listed in table's index
Posted by darek at 4/16/2007 4:45:11 AM
Hi, when comparing index structure of two tables in different databases, I'm getting following difference: Source table: INDEX [LIST_VAL] ([DG_ID], [SUB_TYPE], [ORDER_BY]) Target table: INDEX [LIST_VAL] ([SUB_TYPE], [DG_ID], [ORDER_BY]) As you can see, the difference is the sequence...more >>

Scripting Table
Posted by Kayda at 4/16/2007 3:37:21 AM
Hi: I need to move 3 tables from one server to another, the two servers (source:2005, target:2000) not having connectivity, (so I can't use DTS). They are part of a larger database, and I don't want to back up the whole database and restore it. When I use TOAD for Oracle, I can script a tab...more >>

scope_identity doesn't work through distributed transaction
Posted by jareksmcp NO[at]SPAM gazeta.pl at 4/16/2007 3:34:50 AM
Hello. I got short example: --tabel X was created on SRV; database DB create table [x] ( [i] [int] IDENTITY (1, 1) NOT NULL , [txt] [char] (10) NOT NULL , constraint [PK_x] primary key clustered ([i]) ) --start of script with unexpected behaviour begin distributed tran set xact_a...more >>

datetime convert problem, 'mon'->'mm', 'Apr'->'04'
Posted by zh.charlie NO[at]SPAM gmail.com at 4/16/2007 1:20:58 AM
Hi, I found the following script results differently on two servers: select convert(varchar, getdate() ) server1: '16 Apr 2007' (expected) server2: '04 16, 07' And all format codes for the convert function that presents a month as 'mon' will show a two digital number for the month on se...more >>

mirroring & backups
Posted by Panos Stavroulis. at 4/16/2007 1:12:02 AM
Hi, I have a mirrored databased, which is in FULL recovery mode. I take log backups every 1 hour and db backups every night. However, the log file keeps increasing and due to mirroring I can’t shrink the log with shrinkfile. Is this the recommended set-up for mirroring, am I trying to be ...more >>

About store procedure
Posted by hui at 4/16/2007 12:00:00 AM
I wrote a store procedure in sql server to update MyTable with some parameters and return the updated dataset by a select clause. When I execute then procedure in Query_Analyzer, it works well and the record_count of the dataset is right. But I call the procedure by ADO, it works and return doub...more >>

How the hell do i create stored proc in Sql 2005??
Posted by Richard Coltrane at 4/16/2007 12:00:00 AM
Hello, Ive fired up Sql 2005 Express studio. All i want to do is create a Stored Proc. I go programmability>Stored Procs>Add New... and i get a template full of garbage. How do i scrap all that junk and just have it create a blank page so i can CREATE..... Secondly whenever i try to s...more >>

Snapshot from Mirror
Posted by at 4/16/2007 12:00:00 AM
Can a snapshot be created from a mirrored database? I want to mirror a principal db to a remote server, however, I would like to look at the mirrored db every so often. I was thinking that I might be able to create a snapshot of the mirrored db (in its restoring/mirrored) state to a new da...more >>

cascade removing records from related table
Posted by Dariusz Tomon at 4/16/2007 12:00:00 AM
Hello Is there any place in Sql 2005 where I can define that during removing a record from table A also recored from table B should be removed (table A is main table and table B is related table). Best Regards Darek T. -- Mazars & Guérard Audyt Sp. z o. o. Z siedzib± w Warszawie ...more >>


DevelopmentNow Blog