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 > june 2005 > threads for tuesday june 7

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

I need help with rolling back transaction
Posted by Chris at 6/7/2005 11:48:01 PM
Hi, I have the foll statements that are calling a dts package. I deliberately misspelt the table name on the last update statement but my transaction doesnot rollback why the DTS is suppose to rollback SET NOCOUNT ON BEGIN TRANSACTION Select @doc_no = str_inv_no from dbo.arctlfil...more >>


need help with sample query
Posted by TJS at 6/7/2005 11:37:23 PM
need help getting this work trying to create dynamic whereclause to be executed ========================================= create table proj ( projID INT PRIMARY KEY , projtitle varchar(20) NOT NULL ) INSERT proj (projID,projtitle) VALUES (1,'A') INSERT proj (projID,projtitle) VALUES (2,'...more >>

Export DB to SQL Script
Posted by AJ at 6/7/2005 11:33:03 PM
How? I am wanting to export a db. It is unlikely that i will have access to a destination server via a network or internet connection. So i am intending to export my db to an sql script. I have used the generate sql script option previously, but have found it only exports the db object...more >>

Kill Process - By an User who is not a Member of Process Administr
Posted by Sevugan at 6/7/2005 10:31:02 PM
Hai, I want to Kill a Server Process. I have logged in as an user who is not a member of Process Administrator Role. Can this be done? How to do this? Regards, Sevugan.C ...more >>

How Eliminate Dupes from MAX DATE
Posted by Mike Harbinger at 6/7/2005 8:50:40 PM
I am trying to retrieve the latest Order Entry date for a given Order Type for a given Customer. Using MAX this almost works but it returns mutiple records when the dates are not unique. I tried TOP 1 but that did not help. Is there a way to return just one of the MAX records? Cust ----- ...more >>

getting correct return value?
Posted by Leon at 6/7/2005 7:55:28 PM
why query analyzer is not giving me the correct value back? See code below... "it don't matter if the subdomain exist or not it return zero when I test in query analyzer" sp.......... CREATE PROCEDURE CheckSubDomain ( @SubDomain varchar(30) ) AS IF EXISTS ( SELECT SubDomain FROM Ac...more >>

Locking Help
Posted by Chris at 6/7/2005 7:37:01 PM
Hi, I have a table that stores the next bill number avail for usage and a proc that select the that bill number prepares some bills and then update the table with a new bill number for later usage. I need a way to lock the table after I select the bill then relase the table after I update it ...more >>

Using DSN connection does not work for SQL XML load
Posted by karenmiddleol NO[at]SPAM yahoo.com at 6/7/2005 6:36:48 PM
Hello All I use the following code to load a XML file to SQL Server Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad") objBL.ConnectionString = "provider=SQLOLEDB.1; &_ data source=Serv01;database=mydb;uid=xx;pwd=xx" objBL.ErrorLogFile = "c:\error.log" objBL.Execute "c:\temp...more >>



SQL statement that removes characters
Posted by Mike at 6/7/2005 6:31:11 PM
I have records in a table field with the following (Note the number value after the 4 characters could increase or decrease): ENG\djke2456 ENG\dgut57689 housingtobe\jkli13456 housingtobe\dgyt9021 housingtobe\prgh028765 I would like to know if there is a way within a SQL statement to remove...more >>

XML Bulk Load Mapping Schema File
Posted by David at 6/7/2005 5:58:02 PM
All I have a Stock on Hand table (DDL below) that I am trying to populate using the example XML below. Can anyone assist with the Mapping Schema File so that I can load the XML file using XML Bulk Load as per KB article http://support.microsoft.com/?scid=316005. Thanks for any assistance. ...more >>

QUERY PROBLEM
Posted by Big D at 6/7/2005 5:07:49 PM
I have loaded disk drive information by computername in a SQL DB. I am interested in Freespace. When the data is loaded into DB its in (K). How can I display the freespace in MB? Query: select SystemName,Win32_DiskDrive_Model,Win32_LogicalDisk_FreeSpace from SystemInfo The result is...more >>

Slow calls to COM+ from SQL Server
Posted by John Rusk at 6/7/2005 5:01:01 PM
Hi, I have SQL Server code that calls a COM+ component (which is written in ..NET). SQL Server stored procs make the calls by way of sp_OACreate etc. It runs _really_ slowly on one particular machine. The only difference I can find is that the slow machine is locked down tighter in ter...more >>

convert to string to execute ?
Posted by TJS at 6/7/2005 3:18:19 PM
need some help converting this to a string which can be executed in a stored procedure ================================================================ SELECT @List = COALESCE(@List + ', ', '') + CAST(InvoiceID AS varchar(5)) FROM invoices, Projects WHERE Projects.ProjectID = Invoices.IDProj...more >>

query
Posted by JMNUSS at 6/7/2005 2:55:02 PM
damn touchpads....... I have a query: SELECT id, name, rank, serial_number from status this will return many rows...if all values are null for a single row, i need to be able to assign a unique "id" for that row (PK constraint on another table) is there a way to do this so that for each r...more >>

need example of sproc
Posted by TJS at 6/7/2005 2:50:08 PM
looking for an example of how to correctly build up a dynamic where clause based upon input parameters ...more >>

Cannot perform an aggregate function on an expression containing an aggregate or a subquery
Posted by Gunnar at 6/7/2005 2:33:22 PM
--Hi! --Using SQL Server2000 --I have trouble with a query which is similar to the (simplified and --constructed) example below. create table Salary (pnr int not null, SomeDate datetime, salary int) insert into Salary (pnr, SomeDate, salary) values (1, '2005-06-01', 10) insert into Salary...more >>

Optimizing the query
Posted by Asim at 6/7/2005 2:30:03 PM
I have this code that I am using to populate the number of visits by each day and cost center. I have to create a temp table as first I filled all the days along with cost center and then trying to update the visits. In this way I can get all the cost centers even if some of them had no visits...more >>

subtracting 16 hours from today...
Posted by Roz at 6/7/2005 1:42:06 PM
Hello, all. How can I substract 16 hours from today (ie rightnow, getdate)? Sounds simple, but I can't seem to get it. Thanks Roz...more >>

update statement
Posted by simon at 6/7/2005 1:29:20 PM
I have update statement: UPDATE r SET r.comment=case when r.comment is null then e.Parcel_No else r.comment+';'+e.Parcel_No end FROM table1 r INNER JOIN table2 e ON r.[ID]=e.[Invoice_No] If I have 2 or more rows in the table2 with the same Invoice_No, I get always one Parcel_No into fi...more >>

SP4 and error Query contains an outer-join request that is not per
Posted by Carlos Eduardo Selonke de Souza at 6/7/2005 12:58:02 PM
Hello I have a SQL Server SP4 instalation and a SQL Server SP3a instalation. I have a store procedure that runs fine on the SQL Server SP3a but when I run the same storeprocedure on the SQL Server SP4 I got the error message: Server: Msg 301, Level 16, State 2, Line 13 Query contains an ...more >>

remove .000 from the end of the decimal number
Posted by Ramunas Balukonis at 6/7/2005 11:35:03 AM
Hi experts, I have a variable with type decimal(9, 3). Is it possible to return the values without 0 at the end when it is unecessary ? Examples: 1.000 should return 1 0.750 should return 0.75 0.500 should return 0.5 0.125 should return 0.125 Or should I write the function for that con...more >>

Efficient record storage 10+ Million records
Posted by Ben at 6/7/2005 11:31:45 AM
I have a database that stores survey information. I've been asked to add information to it to test scalability. Well, its' hurting. What I have is a 'sample' table or the people that took the survey and then several related tables. Lets' say the sample table looks something like tblData_S...more >>

can a query be written to do this...
Posted by BW at 6/7/2005 11:30:35 AM
I have the following table defined: Not my design/idea and I can't change it) CREATE TABLE [dbo].[Task] ( [TaskID] [ROWIDENTIFIER] NOT NULL , [Name] [SHORTNAME] NULL , [Description] [SHORTDESCRIPTION] NULL , [PreviousTaskID] [ROWIDENTIFIER] NULL , [NextTaskID] [ROWIDENTIFIER] NULL , ...more >>

using format_string
Posted by Jason at 6/7/2005 11:26:59 AM
Hi, Can anyone explain me how to use the format_string in sql server 2000? I want to format dates for e.g. month(getdate()) gives me 6, but i want it to format it as june. Anyone knows the solution? ...more >>

How do I speed up this self-referencing query?
Posted by Robert Chapman at 6/7/2005 10:28:01 AM
Hi, I am running this query below which aims to consolidate the data from a table called Fin0AllAustria into a table called Fin0Austria. Fin0AllAustria's primary key is SE (an ID number), RS (which can be 'R' or 'S') and Quarter combined, while Fin0Austria's primary key is SE. Therefo...more >>

Blocks and Locks in SQL
Posted by Lontae Jones at 6/7/2005 10:25:01 AM
If you have an job interview question of how do handle SQL locks and blocks whats your answer?...more >>

Performance issues when using stored procedure local variables and non-clustered indexes
Posted by Guest at 6/7/2005 10:06:16 AM
Hi there, I've seen a lot of David Gugick's posts regarding a problem using= stored procedure local variables and non-clustered indexes. It's= definitely a cause for concern having seen how many stored= procedures actually use local variables to pass in a value into= a query's search clau...more >>

get the ID value from MAX value of a set of columns?
Posted by icebold54 NO[at]SPAM hotmail.com at 6/7/2005 9:39:11 AM
Hi to everybody I'm having some trouble while trying to solve this issue. I have this table: DAY HOUR MINUTE ID FIX_VALUE_A FIX_VALUE_B VARIABLE_C VARIABLE_D VARIABLE_E 103 897544 750916 26 17 04 ...more >>

Bug in sp_updatestats
Posted by BDB at 6/7/2005 9:36:12 AM
Hi, In the BOL is says that DBO and sysadmin role can execute sp_updatestats. However, the database owner gets this error: Server: Msg 15247, Level 16, State 1, Procedure sp_updatestats, Line 14 User does not have permission to perform this action. I've found that I can only run it as sy...more >>

Multiple Records merge SQL Guru
Posted by Christian Hamel at 6/7/2005 9:15:10 AM
Good morning everyone, I would like to create a query that returns merged rows using a comma delimited list. I've seen many post regarding this point and I found very usefull information. The thing in my case is that I do not want only 1 row to be returned but many. Let me show first a da...more >>

Get Files From Backup Directory using SQL DMO
Posted by Sergey Zuyev at 6/7/2005 8:36:02 AM
I am in the process of writing a backup utility for a client. I’m trying to create a pickup form that will let the user to select a backup file from SQL Server local directory, similar to Enterprise Manager Backup Wizard filename pickup form. I’ve got list of Directories from SQLDMO.Serv...more >>

So called earliest date
Posted by Steve Schroeder at 6/7/2005 8:13:40 AM
If I have a data set that contains a date field, and I want to return the one earliest in the results would this work best (and all the time?)... Select Top 1 fldClientInv, fldFilingDate From tblPriority Where fldClientInv = '14095.0005' Order By fldFilingDate In the result set above, there...more >>

OPENQUERY ISSUE
Posted by Dan H. at 6/7/2005 7:45:16 AM
I am trying to pass a variable to an openquery stmt within a proc. The following worked a couple of times, but I am receiving the error below now ? Any suggestions on a method to pass the variable into the OPENQUERY Statement ??? CREATE PROCEDURE usp_GetData (@REQUEST_ID as varchar(10)) ...more >>

Need to search table for "if not this, then that"...
Posted by l.woods at 6/7/2005 7:34:21 AM
Example: A table: Field1 varchar Field2 varchar Now, I want to retrieve all Field1's in this table based upon the following criteria: If Field2 = "X" then retrieve record Else If Field2 = "T" then retrieve record Else If Field2 = "A" then retrieve record Else Don't retrieve record...more >>

critical issue with linked servers
Posted by Enric at 6/7/2005 7:24:03 AM
Dear gurus, I’ve created a link between an A server (sql2000k) and an B server (sql2000k). They belong to different NT domains as well as different countries. That link has been created from one third server-country but I think that doesn’t matter so that’s not strange at all but th...more >>

Why the difference in execution plans?
Posted by Cris_Benge at 6/7/2005 6:14:02 AM
I've been working on a new client-site with over 4000 stored procedures that were reverse-engineered from an Oracle application (into SQL 2k sp3), and have been handling the task of tuning many of the under performers. One quirk to the reverse-engineering solution they used is that the syntax...more >>

Invalid object name in stored procedure
Posted by SteveInSC at 6/7/2005 4:51:04 AM
-- In SQL Server 2000 --When run from Query Analyzer I correctly get identification of line numbers having duplicate values of SKU_NameUsedBySCS: -- LineNumber1 LineNumber2 -- 2 5 -- but when I try to create a stored procedure having this same code I get: -- Invalid object n...more >>

ISO 11179-5 for element naming
Posted by decland NO[at]SPAM petml.com at 6/7/2005 3:45:12 AM
Following advice in this group, I've been reading ISO 11179-5 for element naming. They give an example where redundant words in the representation term are deleted e.g. Employee_LastName_Name becomes Employee_LastName. When this column appears in my Employees table, is it acceptable to remo...more >>

ntext column
Posted by x-rays at 6/7/2005 2:41:01 AM
Hello experts, I'm having a problem showing the result of two concatenated nvarchar variables which retrieve data from an ntext column, is this a known problem? is there any solution for that? declare @a as nvarchar(4000) declare @b as nvarchar(4000) Select top 1 @a = SUBSTRING(ntextcol, ...more >>

Autonumber when inserting
Posted by LeSurfer at 6/7/2005 2:23:02 AM
Hi i have a problem that i can´t solve! I have three tables last_id, customer, prospect. The "last_id" table have one colum that stores the last used id number (int), customer tables stores info about the customer and a "last_id" number and the prospect stores new customers! I want to make ...more >>

sp_detach_db Problems
Posted by Jono Price at 6/7/2005 12:30:30 AM
Hi, I hope this is the correct place for this. I need to make a copy of the files that make up a database. I am working in C#. I do something along the lines of the following not syntactically correct thing: SqlConnection(...Database=myDatabase...) SqlCommand(sp_helpfile) //to get the nam...more >>

urgent help pls - many to many relation
Posted by Walter W at 6/7/2005 12:00:00 AM
hi, i have 4 tables: Contract, PaymentRequest, CreditCard, BankAccount CREATE TABLE Contract ( ContractId int identity(1,1) primary key, Duration int, TotalAmount money ) CREATE TABLE PaymentRequest ( ContractId int references Contract(ContractId), BankRefId int, ...more >>

Silico-Magnetic Intelligence Training CDs
Posted by Dave Morgereth at 6/7/2005 12:00:00 AM
I'm looking for some CD-Rom based SQL Server training for some of my .NET developers and am wondering if anyone has used the Silico-Magnetic CDs? If so, are they any good? Can anyone recommend any other training materials. Here's the amazon.com link to the Silico-Magnetic training: htt...more >>

problem with distributed transaction via linked server
Posted by Nishanth at 6/7/2005 12:00:00 AM
hi, i am trying to connect to oracle 9i using sqlserver 2000 linked server. here the linked server name is intersql. when i put this statement in begin and end transaction block and try to execute it is giving the following error Server: Msg 7391, Level 16, State 1, Procedure ihmtproc_em...more >>

Free space not used.
Posted by Fabri at 6/7/2005 12:00:00 AM
Executing exec sp_spaceused <my_table> I notice this: reserved --> 4483504 KB data --> 2536720 KB unused --> 1896984 KB I have to "free" that space and I tried the following: 1) DBCC DBREINDEX (<my_table>) 2) DBCC SHRINKDATABASE ('<my_db>') but the didn't work. How can I do...more >>

sql quest
Posted by ichor at 6/7/2005 12:00:00 AM
hi what is a workload file? ...more >>


DevelopmentNow Blog