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 2004 > threads for wednesday january 28

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

DBCC message suppress
Posted by Vlad at 1/28/2004 10:21:11 PM
Is there a way to suppress the DBCC message? Some TRACE switch or SET ? <<DBCC execution completed. If DBCC printed error messages, contact your system administrator.>> Thanks Vlad ...more >>


Help with Incrementing
Posted by J at 1/28/2004 10:18:48 PM
Hi, I'm using SQL 7 and I'm trying to automatically assign ID Numbers. The numbers must be in an alphanumeric format using three letters and incrementing five numbers.I have two sites where the letters represent the site and the numbers represent the visitor. For instance: Site A...more >>

Special Characters (like ä ü ö ß) in OSQL with ANSI input file
Posted by TJTODD at 1/28/2004 10:08:56 PM
We are seeing a problem when we execute the following insert statement using OSQL: insert into test values ('träüößining') The data that gets inserted into the table then has the following value: trSn÷¯ining If we run the query in query analyzer - it works fine (the intended values ...more >>

INSERT INTO is duping
Posted by shank at 1/28/2004 7:07:17 PM
I'm trying to log query strings users are sending our page. The below SP is inserting duped values. Is there any obvious reason as to why it would do that? Everytime a query is made, 2 identical records are inserted. Thanks ----------------------------------------------------- CREATE PROCEDURE s...more >>

Estimating Table Size
Posted by Scott Buerkley at 1/28/2004 7:06:25 PM
I would like to try to plan the growth of a database over time. Is there a good article out there that describes how much different data types use in bytes? Like nvarchar with length of 50 will use 2 bytes per character, so if the field is full, it will use about 100k per record. Thx, Sco...more >>

Current date and time as the Default Value for a DateTime Field
Posted by Scott Buerkley at 1/28/2004 6:08:00 PM
Hello all. Is there a way to have the system date and time entered into a datetime field when the record is entered into the table? I see the Default Value column, but what would I enter there to get this to work? Thx, Scott Buerkley ...more >>

sp over 2 differente DB
Posted by Bruno Alexandre at 1/28/2004 4:58:47 PM
Hi guys, I wonder How can I build a Store Procedure with two connections? What I need is to develop a SP to backup the SQL DB that's on Internet (Hosting Company, and they do not replicate it, well, not without any more money). DTS does not have any tool to do that, just ADD, DE...more >>

Interpreting Error Message
Posted by Yong at 1/28/2004 4:27:57 PM
Can someone please help me interpret this error message? I was running a scheduled job for a model and it keep failing with this message: Warning: Null value eliminated from aggregate. [SQLSTATE 01003] (Message 8153) DBCC execution completed. If DBCC printed error messages, contact your...more >>



Capitalize
Posted by Fabrizio Maccarrone at 1/28/2004 3:57:48 PM
Is there an UDF that can Capitalize a result set? I mean not only a string but a set of rows.... Any help appreciated. Regards -- Fabrizio Maccarrone -- YAMSSQLU (Yet Another MSSQL User) ...more >>

Can I shorten this statement?
Posted by Sam at 1/28/2004 3:33:57 PM
I use this statement a lot in my procedure: SELECT * FROM MyTable1 WHERE MyField1 IN (SELECT DISTINCT MyField1 FROM MyTable2 WHERE ...) Can I do something lie this: SET MyTempTable = (SELECT DISTINCT MyField1 FROM MyTable2 WHERE ...) and then use: SELECT * FROM MyTable1 WHERE M...more >>

IN versus OR operator in WHERE clause AND IN with lots of values
Posted by Raghu at 1/28/2004 3:30:06 PM
Is there any preference to using IN versus OR operator in a WHERE clause? The following query: SELECT * FROM Customer WHERE CustID = 1 OR CustID = 5 OR CustID = 10 can also be written as: SELECT * FROM Customer WHERE CustID IN (1, 5, 10) Certainly the latter query is concise. Also I hav...more >>

How to find a tables row size?
Posted by Ryan Breakspear at 1/28/2004 3:06:34 PM
Hi Guys Is there an easy way to find out a tables' maximum row size? I know I can run sp_help <tablename> and then sum the length field, but I want something I can use in code. Any ideas? Thanks in advance Ryan ...more >>

SQL 2000 Backups
Posted by ktuel NO[at]SPAM streck.com at 1/28/2004 2:53:21 PM
I am still learning about SQL Server, if I am way off, please don't call me names. I keep seeing people mention backing up the master database. Why do you need to? Our backup plan is: Complete each night, then a differential every hour, and a transaction log backup every 5 minutes, deletin...more >>

Asyncronous Bulk_inserts
Posted by Mark at 1/28/2004 2:33:20 PM
I have a Sql Agent Step that does 30 individial Bulk_insert loads on 30 tables. This occurs on a 4-way SMP server. The server CPU and memory are very under utilized. Only one cpu in 4 do around 20-50% loading. The Sql Server seems to be running each bulk insert statement sequentially. Is...more >>

SQL Query Optimization
Posted by Brad M. at 1/28/2004 2:31:16 PM
CREATE TABLE [Customers] ( [CustomerID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [ClientName] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Attention] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Department] [varchar] (150) COLLATE SQL_Lat...more >>

Multiplying Rows
Posted by J. Joshi at 1/28/2004 1:59:08 PM
How would one multiply every row in a table to in effect, get multiple iterations of the same row 13 times, starting from 0 to 12. This would mean one unique row would have 13 entries. Any possible way in SQL? Joshi...more >>

Incorrect Syntax Near COLLATE
Posted by Ivan Hill at 1/28/2004 1:51:09 PM
Why does this generate this error: Incorrect Syntax Near COLLATE CREATE TABLE [dbo].[DEMO_Subscribers] ( [SubscriberID] [int] NOT NULL , [Email] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [DateAdded] [smalldatetime] NULL ) ON [PRIMARY] GO What I am trying to do: I was...more >>

Script to generate stored procedures
Posted by Sara at 1/28/2004 1:42:34 PM
Hi - I am trying to write a script that will generate a stored procedure to add data to a table. I would like this script to read the table for the field lengths and type and set up the stored procedure. The idea is to make it generic enough that by giving it the name of the table it ...more >>

Time Query
Posted by Andrew Mueller at 1/28/2004 1:10:57 PM
My Database Structure is: CREATE TABLE [WASTE] ( [LineID] [int] NOT NULL , [LocationID] [int] NOT NULL , [WasteID] [int] NOT NULL , [Waste] [float] NOT NULL , [SKU] [bigint] NOT NULL , [TimeStamp] [datetime] NULL ) ON [PRIMARY] GO The TimeStamp field is both date and time... In ...more >>

SQL / ADO issue when upgrading to SQL 2000
Posted by TWiSTeD ViBE at 1/28/2004 12:24:17 PM
Hi Folks, We recently upgraded to SQL 2000 from SQL 7. We run a Classic ASP based website using this server as the backend. We thought the migration went seamlessly - but it seems that INSERT statements that also return the identity column ID now don't work properly. For example (in ASP usi...more >>

FILLFACTOR (SCAN DENSITY VS. AVERAGE PAGE DENSITY)
Posted by SQL SERVER at 1/28/2004 12:15:52 PM
Scenario: Created a clustered index and nonclustered indexes on a table with 5,953,675 rows using a fillfactor of "95" for clustered index and "98" for nonclustered indexes. After 82,119 inserts (.01 of table), the nonclustered indexes had a value of "83" for scan density, "4" for logic...more >>

problem with system.data.dll development vs live
Posted by CC at 1/28/2004 12:07:50 PM
When I change the SQL server name in the connection string in vb.net from the test server to the live server and run the program I get : an unhandled exception of type 'System.Data.SqlClient.SqlException' occured in system.data.dll It does not happen to all the connections, some work f...more >>

FYI: SQL Reporting Services download is available!!!!!!
Posted by Andy Svendsen at 1/28/2004 11:41:16 AM
http://www.microsoft.com/sql/reporting/productinfo/trial.asp If you have a SQL 2000 license, you can use the software. I don't work for Microsoft, but I am excited enough to see this that I wanted to send out the link. I have been waiting a long time to move beyond the limits of Infomaker or...more >>

Scrubbing Addresses
Posted by Ray Higdon at 1/28/2004 10:52:02 AM
Hello all, I have a column with street address information in it. I need to parse it and split it into two columns, one for address number and one for the rest of the data. I have alreay created some SQL scripts to work on this but am sure this has been done before and wondered if anyone h...more >>

Effect of changing datatype from nvarchar to varchar
Posted by goodideadave NO[at]SPAM hotmail.com at 1/28/2004 10:38:10 AM
Hi, All: I have this table in my production database: CREATE TABLE tblSessions ( SessionID int IDENTITY (1, 1) NOT NULL , PersonID int NOT NULL , BeginDate datetime NOT NULL , EndDate datetime NOT NULL , FinishTypeID int NOT NULL , CaseloadID int NOT NULL , OffenseTypeID int NOT NU...more >>

Quick puzzler
Posted by Jim Corey at 1/28/2004 10:36:10 AM
I have: Table Foo Section Owner A1 Fred B1 Fred C1 Joe D1 Sam E1 Sam And I would like a result set like: Owner Sections Fred A1,B1 Joe C1 Sam D1,E1 I don't have a limit on the number of sections for each owner, but...more >>

IRowID
Posted by Joe at 1/28/2004 10:28:41 AM
Does anyone know if IRowId is a valid variable in Transact- SQL? I know PL-SQL has it but I just seen it used within the context of Transact in an example on the web. Thanks for any help, Joe...more >>

Help with a Dynamic CrossTab
Posted by George Durzi at 1/28/2004 9:59:33 AM
Inside a stored procedure for one of my reports, I've built and filled the table @Pivot as shown below. I'm collecting information about the performance of a sales person based on a Year, Quarter, and a certain metric. The calculations measure the metric for New clients (MetricNew), for Existing...more >>

update tab1.text = tab2.text
Posted by sue at 1/28/2004 9:41:04 AM
tab1 (id int, desc text tab2 (id, int, desc text Need set tab1 text field desc with tab2 text field desc. How do I do it thanks -sue...more >>

ORDER BY with CASE
Posted by Vern Rabe at 1/28/2004 9:29:31 AM
Why doesn't this work? It returns this error message: "Invalid column name 'au_lname'". I couldn't find anything in BOL or KB explaining. SQL 2K SP3/3a, Win2K SP4. use pubs -- this causes the error select 'X' AS [au_lname] UNION ALL select au_lname from dbo.authors order by case when...more >>

Executing Dos XCopy command using xp_cmdshell
Posted by KissLizzyCooper at 1/28/2004 9:21:10 AM
I am trying to execute the DOS xcopy command using xp_CmdShell... DECLARE @strCmd VARCHAR(80) DECLARE @strPath VARCHAR(100) SELECT @strPath = '\\Machine1\C$\Path1 \\Machine2\C$\Path2 /s' SELECT @strCmd = 'C:\WINNT\System32\xCopy.Exe ' + @strPath EXEC Master..xp_cmdShell @strCmd GO The pa...more >>

stored Procedure security issue
Posted by clifford at 1/28/2004 9:20:27 AM
here's my stored procedure: CREATE PROCEDURE proc @id varchar(50),@pswd varchar(20),@no_go int OUTPUT AS SET NOCOUNT ON SELECT user_id FROM profile WHERE user_id = @id AND pswd = @pswd IF @@ROWCOUNT = 0 BEGIN SET @no_go = 1 END ELSE BEGIN SELECT date,date_mod FROM ans WHERE user_id =...more >>

plz-help enumeration database objects that users roles have ?
Posted by simo sentissi at 1/28/2004 8:08:29 AM
Hello I I just inhertied a database that I am trying to document. I have many user roles and users under this database. and I want to put in the documentation the user roles and the tables and object they have access to them. as well as the users under the roles. ofcourse there are a lot of d...more >>

Indexing
Posted by bbitzer at 1/28/2004 7:57:17 AM
If a table has a concatenated primary(Col_A, Col_B) and it is a keyclustered index where each column is a foreign key from another parent table; would it be necessary to create nonclustered indexes on each individual key (one on Col_A and another on Col_B)? Or, would SQL Server use the clu...more >>

8K limit of varchar: need workaround
Posted by TomT at 1/28/2004 7:51:06 AM
We send out shipment emails nightly, and these are created and sent by a stored procedure. The body of the message is assigned to a varchar variable, however there are times when the body exceeds this length, and is truncated. I can't use a text variable, so I don't know what would be the best ap...more >>

Text Datatype?
Posted by John Rugo at 1/28/2004 7:09:51 AM
Hi All, I have been using a VarChar(4000) to store Comments. I am running into a situation where this is not enough space for some Comments. I am thinking of changing over to a TEXT datatype. Can someone please give me the pros and cons of this? Thanks, John. ...more >>

Using GOTO in sproc is slower than not using it.
Posted by Steveo at 1/28/2004 6:18:52 AM
Using a goto in a sproc is slower than not. I had a sproc to select data from a view dependant upon parameters parsed to the sproc. Originally I did not use a goto, but thought that logically it would be quicker if I did. So at the start the first few lines decide what is being parsed, th...more >>

Interesting INSERT issue
Posted by Valmir Meneses at 1/28/2004 3:56:08 AM
Hi As I was stress-testing an application and decided to CROSS JOIN the table with a multiplier table Created MULTI CREATE TABLE [dbo].[Multi] [ID] [int] IDENTITY (1, 1) NOT NULL ) ON [PRIMARY Then I was faced with the issue. How can I insert in the table If I use SET IDENTITY_INSERT MULT...more >>

Stored procedures for e-mailing table updates.
Posted by jigginjim at 1/28/2004 2:38:05 AM
Does anyone know how to import an e-mailed table into sql server using a stored procedure. I'm trying figure out how to do this for my final year project at Plymouth University (UK) and not really getting anywhere! Any help would be really appreciated. --- Posted using Wimdows.net NntpNews Com...more >>

Table sysobjects: Content of fields category
Posted by rene at 1/28/2004 1:51:05 AM
H I'm very new to the SQL server environment and make my first steps with stored procedures. I would like to drop views in one database (call it DB1) and use another database (call it DB2) to create views in DB1 using the tables in DB2 When dropping the views in DB1 I only want to drop those who ...more >>


DevelopmentNow Blog