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 2004

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

Help DTS package
Posted by Sivla at 4/30/2004 11:05:21 PM
I need to run a dts package from a command line that accepts a parameter. then opens a text file on my c: \files folder and reads the contents of the file into a table in a database ...more >>


Server: Msg 8626, error on Insert Statement
Posted by Mark Butler at 4/30/2004 10:25:49 PM
Why does the following insert statement produce the error that follows the code. ============================= INSERT INTO diary ( di_user, di_notes, di_dest_pk, di_dest_fm ) SELECT froi.fr_efroi, 'Claim: '+froi.fr_claimno, froi.fr_mco_itn, ...more >>

SQL select and compare help
Posted by E-Star at 4/30/2004 10:03:58 PM
Situation: Table 1 has car records with a field called 'color'. Table 2 has a list of all the current 'color's available. However, the current list in table 2 may not have all the colors available in table 1........say a certain color is no longer offered, however there are still cars from ...more >>

BCP Format Files
Posted by bkc98 NO[at]SPAM excite.com at 4/30/2004 9:38:30 PM
Hi there, I have written a .net application that performs various extracts from our SQL Server 2000 database. I'm using bcp commands for each extract. Now, we currently have a DTS extract solution in place, but it's slow and difficult to maintain. This new .net application should definitely h...more >>

Using a select statement with in a select statment
Posted by sh0t2bts at 4/30/2004 8:26:33 PM
I am trying to get a result that looks like this:- 52513, Fred Bloggs, 26/04/2004, 762.16, 2856.21 Now the query below brings back the above line, but this is only because I state which Customer number to bring back, if I leave the customer number out of the statment it brings back ever...more >>

creating a schedule/job table
Posted by Guy Brom at 4/30/2004 6:10:21 PM
Hi there, I'm trying to create a scheduler table with options to specify daily, hourly, weekly and monthly jobs, including multiple schedules and from--to variables. Is there an exposed table structure of sql's great scheduler? the one used for sqlagent jobs. If not, does anyone has a white...more >>

Serious Deadlock Problem
Posted by Lucas Ponzo at 4/30/2004 6:01:03 PM
Hi, I have a serious deadlock problem. I'm using the Profiler with Lock:Deadlock, Lock:Deadlock Chain, TSQL:Batch Completed and TSQL:STMT Completed event classes. Im the very load circunstances, the CPU goes to 100% and SQL Compilations/sec are over 300 ... In the situation I cannot see ...more >>

Owner Qualified procedures and compiles
Posted by Paul Cahill at 4/30/2004 4:52:32 PM
I read somewhere that to avoid recompiles and compile locks that one should create all procedures with a qualified owner name. eg create procedure dbo.myproc Would it also be true that for EXEC's from within a procedure that one should qualify the owner on the exec call. eg create proce...more >>



SELECT chronologically across rows?
Posted by Abdullah Kauchali at 4/30/2004 4:07:21 PM
Trying to do a "whodunnit" query: I need one SELECT statement to find out which UserId(s) changed the STATUS to "CLOSED" from a previous STATUS *other than* "PAID"? JACK changed the Claim Status on 2004-04-27 to "CLOSED". However, I want the row where BILLY changed the Status to "CLOSED" on...more >>

Parameterizing "TOP" in a Stored Procedure
Posted by John at 4/30/2004 3:26:03 PM
I've got a simple problem, but the answer has eluded me I need to pass in a maximum number of records to retrieve to a stored procedure. I had thought I would just be able to do - Create Procedure uspEasySelect a @max as in SELECT TOP @max FROM tblMyTable ORDER BY CreateDate DES -...more >>

Rename table from stored procedure
Posted by Tore Gylver at 4/30/2004 2:29:41 PM
Is it possible to rename a database table from a stored procedure? If so, how can this be done? Regards Tore G. ...more >>

DISTINCT vs. ORDER BY
Posted by Rick Charnes at 4/30/2004 2:27:21 PM
Column location_id is an int, but because of other fields I need to display it as a text element. So I use convert(): SELECT convert(varchar,location_id)... FROM mytable ORDER BY location_id 1 2 3 10 22 23 24 Perfect. But later development mandated the use of SELECT DISTINCT. ...more >>

Select treeview
Posted by Pyro at 4/30/2004 1:41:35 PM
I have folowing situation: DDL: CREATE TABLE MyTree ( NodeID int NOT NULL , NodeName varchar (255) , ParentNodeID int NULL , Lvl int NULL /* indicates node depth */, OrderNumber int NOT NULL /* indicates order in leaf */, CONSTRAINT PK_MyTree PRIMARY KEY CLUSTERED (NodeID), CON...more >>

use parameter in openquery
Posted by joe at 4/30/2004 1:22:19 PM
I don't think it's possible to use parameter with OPENQUERY,following query have problem. DECLARE @emp_id int SET @emp_id = 5 select * from OPENQUERY(SERVER1, 'SELECT * FROM TABLE1 WHERE id =@emp_id') ...more >>

T-SQL ::fn_virtualstats
Posted by moharss NO[at]SPAM auburn.edu at 4/30/2004 1:01:39 PM
I get wierd looking timestamps out of T-SQL ::fn_virtualstats. Is there some way to draw sense of out those ? Thanks in advace. _Sourabh...more >>

sp_OAGetProperty Strangeness - Requires Workaround
Posted by Camel Software at 4/30/2004 12:53:54 PM
Hi, I'm in process with some code, so please ignore the fact that it's so messy (see below). Anyway, I've noticed that the code will not execute unless I set the variable @freeSpace to some value, like 0. If it's a NULL, the call to the "FreeSpace" property will yield the error: "Error in s...more >>

questions on interview
Posted by joe at 4/30/2004 12:26:50 PM
Hi guys, If you're a guy who is doing interview to hire sql developer, what kind of questions I should ask them? just give me some opinions.. ...more >>

Listing fields in order
Posted by Stu at 4/30/2004 12:13:45 PM
Hi, I am using the systables objects to list the fields in a table. How do you list the fields of a table in the order they appear in Enterprise manager? Thanks in advance, Stu ...more >>

Which is better method?
Posted by msnews.microsoft.com at 4/30/2004 12:12:20 PM
Hello, I am writing a SP which inserts or updates into a table. The SP has to decide wether to update or inert... which in theory causes less load on the dbase server? declare @rows numeric select @rows = count(*) from answers_attributes_2 where id_attribute = 81 and id_entity = 2 i...more >>

Previous Working Week
Posted by Kevin Lorimer at 4/30/2004 11:36:39 AM
I am trying to list data from the previous working week e.g. Today 30/04/04 would return two dates 19/04/04 and 23/04/04. Regards ...more >>

Help with select into Statement
Posted by Brad at 4/30/2004 11:31:19 AM
I am trying to run a select into Query from one DB Server into another DB Server. Here is the Statement. exec sp_addlinkedserver 'srvuser3', N'SQL Server' select * into srvuser3.echda.dbo.tblaccounttypes from dbo.TblAccountTypes I am getting this error The object name 'srvuser3....more >>

Using Openquery to access an oracle table
Posted by msantiago_00 NO[at]SPAM hotmail.com at 4/30/2004 11:24:47 AM
I am wondering if anyone knows why one method works over the other: EX. This query does not work: select * from ORADEV..NTBK.ADDRESS_STATUS_HISTORY@LDM_LINK error message: Server: Msg 7314, Level 16, State 1, Line 1 OLE DB provider 'ORADEV' does not contain table '"NTBK"."ADDRESS_STATU...more >>

Identity columns
Posted by Brian Henry at 4/30/2004 10:56:14 AM
How do you remove an identity constraint on a table once it has alraedy been placed on a table in SQL? (not using EM) thanks ...more >>

Select a record within a recordset
Posted by Ace at 4/30/2004 10:56:09 AM
Hello Here is the scenerio. I have a 'Sales' table which includes sales information such as date sold, item#, amount....and so on. I would like to get a record that has 10th highest sales amount. All I can think of is to get top 10, reverse the recordset and read the top one (which is the 10th ...more >>

How to calculate Median in a group of Data
Posted by Reza Alirezaei at 4/30/2004 10:38:08 AM
I have got a group of data like this Row1 10 Row2 2 Row3 6 Row4 9 Row5 12 Row6 8 and I want to calculate median for it. Thanks for your help. Reza ...more >>

dbcc shrinddatabase error
Posted by SQL apprentice at 4/30/2004 10:35:52 AM
Hi, When trying to use DBCC SHRINKDATABASE, I get the following message for all my databases. Cannot shrink log file 2 because requested size is larger than the start of the last logical log file What does it mean? Is this an error? How can I fix it? Thanks Guys. ...more >>

grant permission on profiler
Posted by joe at 4/30/2004 10:34:31 AM
Hi, we would like to have users use the profiler but we do not want those people to have sa priviledges or changed their current permissions. is that possible or the only way to do this is grant them sysadmin role? ...more >>

strip out html
Posted by Nikhil Patel at 4/30/2004 10:29:34 AM
Hi all, I have a text field in a SQL Server table that stored HTML. I need to strip out the HTML and return only the text from the field. I wrote a VB6 dll to do this. But I am not blae to use it with the text field because a SQL Server variable can store only 8000 characters. So it does not ...more >>

Multi-threading
Posted by canaries at 4/30/2004 10:25:08 AM
Any pointers or documentation on writing SQL and code to take advantage of a database server with 8 CPUs?...more >>

execute stored procedure inside another
Posted by sean at 4/30/2004 10:20:45 AM
HI There, I am trying to execute one stored procedure inside another and concatenate the output of the select statement (if it returns rows) in the body of the email message, could someone help me out with a little syntax please. Sean - Thank you in advance Select domain_name,hosting_du...more >>

How to insert and retrieve text and image data type in SQL Server 2000?
Posted by hb at 4/30/2004 10:09:48 AM
Hi, I looked at the SQL Server online book and couldn't figure out how to insert and retrieve text and image data type in SQL Server 2000. Would you please give some sample code regarding this issue? Thank you hb ...more >>

Custom Calendar View
Posted by SDSills at 4/30/2004 10:06:07 AM
I would like to be able to use T-SQL to determine a day's month/year based on a nonstandard calendar. Specifically, I would like to represent the broadcast calendar, in which a month begins on the monday of the week in which the first day of the month on the gregorian calendar falls. The definition ...more >>

Table locking in transaction question
Posted by clint at 4/30/2004 9:58:29 AM
Hi, I perform the following query (SQL2000): start transaction update test set row1=5 where row2=6 while executing the query table TEST is locked! When I execute: select * from test this query is not responding until I commit transaction. How to solve this strange table locking? R...more >>

Stored Procedures - multiple output parameters
Posted by Crystal at 4/30/2004 9:51:02 AM
I have a simple stored procedure that executes with no problem. It contains multiple count queries all based on difference criteria for the same table. I only receive one return value from the first query. I have tried setting up multiple output parameters with no luck. A sample of this would great...more >>

constraints
Posted by Caspy at 4/30/2004 9:49:36 AM
hi there, please help me to set constraint for the following logic: Two columns A and B in a table, for a given tupple, one AND only one column of A and B can be NULL. In other word, if A is NULL, B must not NULL. if B is NULL, A must not NULL. And A and B cannot be not NULL simultaneousl...more >>

SELECT to get Direct and Indirect Role Membership
Posted by Jeremy at 4/30/2004 9:35:08 AM
The 3 tables defined below implement a many-to-many relationship between users and roles. Beyond that obvious relationship, roles may exist in other roles (and that relationship is determined by the value of tblRoles.[ParentRoleID]. What I need help with is coming up with a query that will ret...more >>

UPDATE statement: Subquery returned more than 1 value
Posted by robert.zirpolo NO[at]SPAM phoenixdb.co.uk at 4/30/2004 9:26:34 AM
Can anybody tell me why the following update statement will not work ? I have declared an IN statement to get the results from the subquery but I get the message "Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is u...more >>

truncate all tables
Posted by mikey at 4/30/2004 8:08:45 AM
Hi does anyone know of a cmd that will truncate all the tables in a database of all its data while keeping table structures in place? Thanks for any help Mikey...more >>

DateDiff
Posted by HartmanA at 4/30/2004 8:05:57 AM
I have a table where I'm using the Getdate() default on a DTS load to a field in a table so I can compare yesterday with today. I need to look at today's record compare to yesterday's and based upon certain fields create a report of the differences. fields in table: 1) emplid 2) useri...more >>

Consecutive number in a SELECT statement
Posted by Carlos Garcia at 4/30/2004 8:01:02 AM
Good Morning I have a SELECT statement and i have to show a consecutive number in the SELECT like this Sample Query SELECT SomeThing AS Consecutive, Field1, Field2 FROM Table Order By Field Sample Results Consecutive Field1 Field -------------- ------- ------ 1 ...more >>

oracle to sql server statement
Posted by Alex Ivascu at 4/30/2004 7:43:20 AM
I have a SP in oracle, and am finding myself in a bit of a difficult situation, trying to convert this particular statement to T-sql: counter := (24 * 60 * 60 * to_number(to_char(tsTime,'J'))) + to_number(to_char(tsTime,'SSSSS')); Thanks for any feedback. Alex Ivascu ...more >>

Leaving ADO connection open
Posted by David Chase at 4/30/2004 7:41:50 AM
I have an application with an Access front-end and SQL 2000 back-end. The tables and views are linked via ODBC. The application opens and closes an ADODB connection very frequently in the application. Is there any benefit or problems with just opening the connection in a startup module and sim...more >>

Find Local SQL Servers when Off Network
Posted by Brian Rogers at 4/30/2004 7:28:56 AM
We use SQLDMO.Application.ListAvailableSQLServers to show a list of all visible SQL Servers. This works great, until the user disconnects his network cable. Now I'd expect to lose the servers on other computers, but we also can't see the servers running on the local box. After some googl...more >>

Stored Procedures
Posted by j.m.autry NO[at]SPAM earthlink.net at 4/30/2004 7:01:18 AM
Is it better performance wise to build separate stored procedures for each table written, or to group all the writes into one major procedure? Also, do you take a performance hit if you leave a connection open throughout an apps life, or should the connection be opened and closed for each tra...more >>

how to alter an image column to accept NULL
Posted by Lou I. at 4/30/2004 6:21:04 AM
Folks I have a table that has an image column Currently that column does not accept NULL I want to change that, so the column does accept NULL So, basically I want to do something like ALTER TABLE MyTable ALTER COLUMN MyColumn image NUL The problem is that (according to Books Online) the al...more >>

Bulk insert for excel files
Posted by SqlJunkies User at 4/30/2004 6:05:11 AM
Hi! I was looking at the "bulk insert" command and I was wondering, can you use this command to upload an .xls file into SQL server? I have been trying with a very small file (one column and three rows) but it doesn't seem to find where the row ends. Is there a special character I would have to ...more >>

exchange qn
Posted by BF at 4/30/2004 5:51:08 AM
Hi I have a load of contact data in SQL Server. Is there any way I can expose this data in Exchange TIA...more >>

Random key in trigger interesting results - please add input - any help appreciated
Posted by Michael C at 4/30/2004 4:46:44 AM
Hi everyone I was testing random key in trigger on insert and got these results Please see the results in code 'Notes : Am I misinterpreting this information and the updatebatch is handling it's own errors while doing batch update and then the failure result is the actually primary key ...more >>

DBGrid
Posted by Ajaykumar Yerawar at 4/30/2004 4:31:04 AM
We are accessing a table in SQL Serever DB with around 50000 records. We need to display the same on to a DBGrid. The application is multiuser application so grid must display the latest data from database In the given scenarion when we are refreshing or making the datasource active it takes too mu...more >>

To Execute Sotred Proc from Visual Basic
Posted by vinod at 4/30/2004 4:21:02 AM
Hi Every bod I need to execute Stored Proc from VB...more >>


DevelopmentNow Blog