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 > december 2003 > threads for tuesday december 23

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

Comparison Operators
Posted by J Jones at 12/23/2003 11:45:20 PM
This may be the wrong newsgroup to be asking about this but I'll ask anyway.. I have 200 possible conditions expressed as comparisons eg. A <= 100 And A > 69. They are stored in an SQL database. I also have a datatable with one row containing 10 values (A,B,C,D,E,F,G,H,I,J). How can I test th...more >>


Typical Query
Posted by ip at 12/23/2003 11:31:05 PM
i have a table as follows create table t1 (a int not null, b varchar(5) null,c varchar(5) null, d varchar(5) null) insert into t1 values(1,'b',null,null) insert into t1 values(1,null,'c',null) insert into t1 values(1,null,null,'d') select * from t1 the result will be .. a ...more >>

How to deal when ODBC throw up 'Connection is busy with results for another hstmt'?
Posted by Willianto at 12/23/2003 10:44:56 PM
Hi all, I insert 183 rows to a specific table in SQL Server (say, T035). The method I used was I created a remote view rv_location with (CREATE SQL VIEW rv_location REMOTE CONNECTION "Conn" AS SELECT T035.* FROM dbo.T035 T035), and do the insertion to the remote view. After the insertion, I...more >>

Odd Timeout Problem
Posted by Keith Cooper at 12/23/2003 10:38:27 PM
Running SQL2K with all service packs... I have a table (tblACH) containing currently about 900,000 rows. The table has 18 columns, 2 of them are indexed. Each day about 5,000 rows are added and one of the columns has a status of 'PENDING'. Every night the PENDING rows are batched into a ...more >>

Reporting Services
Posted by Jay at 12/23/2003 9:39:27 PM
Any one else tried the beta yet? Have to say that I'm most impressed with it as a whole and am looking forward to ridding myself of having to use Crystal. Jay --- Yo! outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.554 /...more >>

sp_password and raiserror
Posted by John De Lello at 12/23/2003 9:28:39 PM
Hey everyone, I have to call sp_password from within my stored proc. I am using the following code: EXEC @iReturnCode = sp_password null, @cNewPassword, @cLogonID IF @iReturnCode <> 0 Print 'Error executing sp_password for: ' + @cLogonID The OLBs say that sp_password...more >>

xp_fixeddrives
Posted by eli_cohen at 12/23/2003 9:25:59 PM
I have seen people using this proc. Can anybody tell me what is this used for. exec xp_fixeddrives 2 Thanks in advance. ...more >>

error handling
Posted by newbee at 12/23/2003 9:20:21 PM
should we do error handling after every DML statement in the procedure. ...more >>



exec to return xml
Posted by Sparko at 12/23/2003 9:19:58 PM
I am using a stored proc with exec (@sString) where I am dynamically building the query to execute. I want to return the results as xml using the for xml auto clause, when I conc my string with 'for xml auto' the procedure complains, any ideas? ...more >>

identity
Posted by sa at 12/23/2003 9:10:40 PM
when we insert a row inside a tran in a table having identiy column, I noticed that in case the tran is rolled back, it does not start the identity value from the same point. It there any way to avoid this. ...more >>

NewBee question
Posted by sandy at 12/23/2003 9:05:49 PM
I have a procedure, say procedure A which calls 2 more procedures B and C , I have started a tran in Proc A. do I need to start more tran for procedures B and C. Currently it is like this create proc a as begin begin tran a do some update exec B exec C commit tran end crea...more >>

sql server services
Posted by amy at 12/23/2003 8:59:19 PM
whenever we ask our DBA that system is very slow, he says that that he will refresh the services and it should be okay. Does anybody has any idea what does that mean? TIA ...more >>

MAX or DISTINCT date and returning row from Joined tables
Posted by Catherine Lynn Wood at 12/23/2003 8:58:33 PM
I just have a habit of picking the toughy tasks to conquer. and just before christmas break too! ugh I have two tables to collect user account information, and subsequent login information. For the sake of this posting, the relevent fields are: members: memberID int(4) [unique primary ...more >>

cache table
Posted by amy at 12/23/2003 8:56:27 PM
somebody posted a post something like this: am writing a stored procedure that processes records in a cache table and then resets the cache table. I would like to use the truncate table statement to delete the rows in the cache table instead of the delete statement. I am curious to know...more >>

Is this feasible?
Posted by John at 12/23/2003 8:19:10 PM
Hi We have an access desktop app with front-end/back-end situation where all tables are in the back end and everything else, forms/queries, are in the front end. We would like to make a web app to use the same access database but are worried about access being able to handle web app users. Is ...more >>

SELECT DATABASEPROPERTYEX shortcut?
Posted by Tonny René Poulsen at 12/23/2003 7:03:20 PM
Hi there. Is there a shortcut to get all the properties for a particular database in one queary, using DATABASEPROPERTYEX? Otherwise you have to ask on each and every one. I tought maybe a query that took the properties from a input list, and placed it in a variable, that in turn was a apart of...more >>

SQL STATEMENT
Posted by Greg Biniek at 12/23/2003 6:40:24 PM
I'm going insane so any help would be greatly apreciated. I have one table with columns Item(PK), Seq(PK), Type(PK), Value. Here is some sample data from the table. Item(PK), Seq(PK), Type(PK), Value A 1 Comment This is a co A 2 Comment mment A 1 ...more >>

left parsing commande error
Posted by Microsoft at 12/23/2003 5:17:56 PM
I am trying to use the statement below in SQL 7 DTS to pad the import of a number to be a specified length. The parsing produces an error on the LEFT command. Any ideas on problems with this code? The code runs fine in query analyzer Any ideas? select {fn CONCAT(CMN_NUM, LEFT('0000000000...more >>

Query help required: using inner joins and subselects
Posted by digitalfish at 12/23/2003 5:02:54 PM
I have a table to hold customers, and another table to hold a record of conversations with customers, as follows: Customers: ID [int] [PK] Name [varchar] (40) Conversations: ID [int] [PK] CustomerID [int] [FK Customers.ID] CallDate [smalldatetime] Conversation [varchar] (100) An exam...more >>

Problem with dynamic SQL
Posted by Star at 12/23/2003 3:30:06 PM
Hi I'm sure this is easy for you guys, but I haven't been able to find the what how to do it, because I'm not very familiar with dynamic sql. I want to insert some data into a temporary table whose name I also create dynamically. I have this: declare @csql varchar(4000) declare @cT...more >>

View error msg
Posted by Perico at 12/23/2003 2:46:07 PM
When I try to save a view I created I get a message "View definition includes no output columns or includes no items in the FROM clause." However, I am selecting columns, albeit from another view. How can I eliminate this error?...more >>

How to display status with programmatically?
Posted by hrhoe at 12/23/2003 2:13:02 PM
OK, I'm sorry for my confusing and ambiguous question that I posted this morning. I got answers from two nice persons. But none of them was the answer that I wanted. I know the Query Analyzer would display status if I run command in the Query Analyzer. What I want to know is: If I run ...more >>

how do you calculate the difference, in years between two dates
Posted by Derek Ruesch at 12/23/2003 2:00:05 PM
I have a date field in my database and I want to calculate the difference, in years, between this date and the current date. This difference has to me exact however. Example: I have a date in my database that is 12/31/2003. This difference should stay at 0 yrs until 12/31/2004 when it ...more >>

Multiple Rows being inserted when one is expected
Posted by Jarrod Hermer at 12/23/2003 1:53:50 PM
Hi, Here is the scenario: One instance of SQL server 2000, Two databases (db1 and db2), ASP.NET, third party app plus a whole bunch of stored procs. The third part app insert one row into the database via a aspx page. The stored procedure that inserts the message into db1 also inserts i...more >>

Stupid me?!
Posted by SLE at 12/23/2003 1:48:23 PM
Hi there, I need a simple (?) query but I can't figure it out. This is a simplified explanation: there is a table tblData having 2 columns (F1 and F2), containing the following records: F1, F2 1, 1 1, 2 1, 3 2, 1 3, 1 3, 2 4, 2 .... Now, my resultset should contain the *first* occ...more >>

Problem with Order by in Union
Posted by MrBug at 12/23/2003 12:04:25 PM
Hi All, I am sorting data with some condition example ---------------------------------------------------------------------------- ------------- Use Northwind go Select * from Products Order by Case When CategoryID > 5 then UnitPrice else UnitsInStock end -------...more >>

Problem with Order by in Union
Posted by MrBug at 12/23/2003 12:04:25 PM
Hi All, I am sorting data with some condition example ---------------------------------------------------------------------------- ------------- Use Northwind go Select * from Products Order by Case When CategoryID > 5 then UnitPrice else UnitsInStock end -------...more >>

Specified SQL server not found: my server
Posted by DC Gringo at 12/23/2003 11:54:40 AM
I've been having trouble connecting to a 2nd instance of a SQL Server 2k with some VB.NET code from my WinXP Prof workstation. "System.Data.SqlClient.SqlException: Specified SQL server not found: my server" My application connects just fine from a Win2k machine with a like Client Network Ut...more >>

dropping a primary key constraint
Posted by NewSQLDBA at 12/23/2003 11:49:03 AM
I dropped ten nonclustered indexes on a 9 million row table and it topk one minute. It took eighteeen minutes to drop the primary key constraint on the same table. Why so long? Am in an OLAP environment. Some SQL Server Performance web sites say drop the nonclustered indexes first. ...more >>

Trouble with quotes
Posted by George Fernett at 12/23/2003 11:48:30 AM
Hi all, I am passing the following: oCmd = "SELECT * FROM jourpf WHERE jounam = '" & oRS.fields("jtrnam") & "'" The problem is that JTRNAM can contain a quote (in this case it contains: O'CONNER) How can I code to allow the inclusion of the quote? Thanks in advance. Happy Holidays...more >>

How to get serial no with select statement
Posted by MrBug at 12/23/2003 11:47:02 AM
Hi All, I need serial number with the select statement One way is : Select (Select Count(*) from jobs J2 Where J2.Job_id >= J1.Job_id ) as sno , * from jobs J1 order by job_id desc no job_id job_desc ...more >>

Create SQL Stored Procedure to replace VB code
Posted by Kevin at 12/23/2003 11:46:21 AM
This is my VB code. It combines two tables through a loop to repopulate a table that is purged periodically. It builds about 30,000 records and takes about 10 minutes or so to run. I'd like to have an equivelent SQL stored procedure I could call so I can reduce my processing time. Thanks for...more >>

Trace SQL statements excuted by ASP
Posted by DN at 12/23/2003 11:19:22 AM
Hi, The environment I have is SQL sever 2000 and IIS 5.0. I have about 100 ASP files in a web application, I like to find a way to trace which ASP is executing what SQL statements against the SQL sever. I've tried SQL profiler, it gave me the SQL statement executed in TextData column,...more >>

Table names in resultsets?
Posted by Dave Veeneman at 12/23/2003 11:06:01 AM
If I create a stored procedure that returns multiple tables, can I specify the names of the tables in the resultset? I have created an SP that returns results from two tables: ALTER PROCEDURE GetLedgerComponents AS SELECT * FROM Ledgers WHERE LedgerStatus = 1 SELECT * FROM LedgerAc...more >>

EXCEPTION_ACCESS_VIOLATION with cursor
Posted by Star at 12/23/2003 10:17:17 AM
Hi I have this SP: CREATE PROCEDURE sp_DataInSlidev2 AS create table #TempFinal ( ID integer ) declare @csql varchar(4000) set @csql='select FK_ID, Name, PropValue from prescustprop, #TempFinal where #TempFinal.ID = PresCustProp.FK_ID ORDER BY FK_ID' set @csql = 'DECLARE crResAux...more >>

Mail
Posted by brian at 12/23/2003 10:00:17 AM
I have been trying to get SQLagent Mail working for some time now and have yet to succeeded. So- I want to start from the beginning. Does it matter how sqlagent starts up? Can it start up under local or system or does it have to be one or the other? I had it working a while back and it...more >>

selecting records
Posted by Jimmy Tran at 12/23/2003 9:40:42 AM
Hi everyone, I have a table that looks like this: TITLE DOCUMENT TYPE abc paper Engineering def project Engineering ghi procedure Manual dyi kit Manual tty document Proposal I want to get a report that will count up these documents, such output is like(corre...more >>

Default Value for a column, based on the data in that column - is that possible?
Posted by Scott Lyon at 12/23/2003 9:33:28 AM
I've got a table set up as such: CREATE TABLE [dbo].[tblMESSAGES] ( [OtherTable_ID] [numeric](18, 0) NOT NULL , [MessageNumber] [int] NOT NULL , [Message] [char] (2048) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ) For this table, both OtherTable_ID and MessageNumber are set up as the...more >>

TRUNCATE TABLE in transactions
Posted by Chris at 12/23/2003 9:16:06 AM
I am writing a stored procedure that processes records in a cache table and then resets the cache table. I would like to use the truncate table statement to delete the rows in the cache table instead of the delete statement. Reason being, the truncate table statement will reset my identity...more >>

How to add reference to a table from an outside database
Posted by Random at 12/23/2003 9:01:00 AM
I know I've done this before, but can't seem to find the option now. I'd like to add a table into my database that exists in another database. Not copy the table over, I want to just have a reference to that table in my database. ...more >>

query results sent with xp_sendmail appear on two lines instead of one
Posted by Derek Ruesch at 12/23/2003 8:45:46 AM
I have a stored procedure that uses xp_sendmail to send an e-mail containing query results. The resulting e-mail used to display each query row on one line. However, the past couple of e-mails display each row on two lines instead of one. I have not changed this stored procedure at all. ...more >>

shrinking file size by deleteing data in image fields
Posted by Russ at 12/23/2003 8:21:05 AM
I have an application that has a table that contains multiple small image files. This table now needs to have it's images archived, but I wish to have the rest of the record remain. I have set the image field data to 'null', and then proceeded to shrink the database. No additional free space was ...more >>

CASE statement in WHERE clause
Posted by Mij at 12/23/2003 8:00:42 AM
Hello, I am trying to put a CASE statement in my WHERE clause depending on the value of @mailed. When @mailed = 1 then I want to make FolUp_Date IS NULL but when @mailed <> 1 then I don't want this condition. I have tried the following but it doesn't work: WHERE Fup.FolUp_ID = 1 AND Fup.F...more >>

View error message
Posted by Perico at 12/23/2003 7:56:12 AM
I'm trying to make a View based on a View, and am getting the error message when I try to save, "View definition includes no output columns or includes no items in the FROM clause." How can I correct this....more >>

How to Display SQL Process?
Posted by hrhoe at 12/23/2003 7:23:57 AM
Hi, I need to know the status of certain process. For example, when I restore database from backup file by using the Enterprise Manager, I can see the progress as the form of progress bar. And if I restore database from backup file by using the Query Analyzer, I can see the progress in the ...more >>

Using an IN clause as a procedure argument
Posted by Paul at 12/23/2003 6:18:37 AM
I want to call a procedure and pass an argument that will be used in SELECT * from table where col1 in (@arg1) Anyone have any idea how to do this? There can be multiple entries for the argument. i.e. 'A1','B1','C4' ... For example: ------------- Create procedure test_proc @arg1 V...more >>

OPENROWSET using trusted_connection=true
Posted by James at 12/23/2003 5:56:15 AM
In my DTS package, my source server's SELECT statement needs to include tables from the destination server. I have been trying to use OPENROWSET to accomplish this. This is what the query looks like so far: SELECT * FROM SourceServer ss INNER JOIN OPENROWSET ('SQLOLEDB', 'Serv...more >>

SQL query to retrieve bottom level of a tree records
Posted by Stephen Livesey at 12/23/2003 5:50:50 AM
I have a file containing the following fields: Level Number Line Number Parent Line Number Product Code This file allows me to structure data as follows: Level 0 Line 1 Parent Line 0 PROD1 Level 1 Line 2 Parent Line 1 COMP1 Level 1 Line 3 Parent Line 1 COMP2 Level 2 L...more >>

openquery
Posted by kgs at 12/23/2003 4:31:34 AM
Iam importing data into a table from another sql server using openquery. Since this is a temporary data i don't want to generate log for the inserted records. I am in multiuser environment while this takes place. how can i accomplish this.? thanks...more >>

What can be replaced NOT IN or NOT EXISTS in query
Posted by Amit at 12/23/2003 4:17:20 AM
Hello, What should I use if I don't want to use NOT IN my query? I also don't want to use NOT EXISTS. i.e. Order table and product table. I want to see all the product that is not in order table or other way any product that doesn't have single sale. Thanks! ...more >>

bcp out
Posted by ip at 12/23/2003 3:26:05 AM
while bcp out i can able to pass max of 1024 lenght for a select query. i have a select query which is more than 2000 length .. how to pass this to querout ...more >>

trigger failure
Posted by Satish at 12/23/2003 2:08:04 AM
Hello, I have written an Insert trigger on a table. The trigger works fine when I insert one row. But when I perform an insert like this: INSERT INTO tableA(col1, col2) SELECT col1, col2 FROM tableB WHERE id in(1,2,3,4) Then the trigger fires only for the first row. It does not fi...more >>

Problem with ODBC and transaccion using ACCESS 97 and SQL Server 2000
Posted by Juan Reyes at 12/23/2003 1:41:05 AM
I use MsAccess linking Sql Server tables via ODBC. With the following code ============== Dim MiBd As Database Dim MiWs As Workspace Dim MiQr As QueryDef Set MiWs = DBEngine(0) Set MiBd = MiWs(0) Set MiQr = MiBd.QueryDefs("jp Contador") MiWs.BeginTrans MiQr.Execute dbSeeChanges MiQr...more >>

Alert on Transaction Log Full
Posted by Anand at 12/23/2003 12:50:43 AM
Hi All, Is it possible to generate an alert before the Transaction Log gets full. For example: My hard disk space is 40 GB My data file is 2 GB (Unrestriced Growth) My Transaction Log file is 1 GB (Unrestriced Growth) Is it possible to create an alert which fires when the Transact...more >>


DevelopmentNow Blog