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 > march 2007 > threads for friday march 9

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

Linked server error 7399
Posted by David at 3/9/2007 3:46:08 PM
I am using a SQL Server 2000 SP4 on Windows 2000 SP4. There is a linked server to MS Access database on a remote machine. The startup account of SQL Server is using a domain account and has full rights to the access DB file. The linked server was working fine until couple of weeks ago. But now...more >>

Import named range or specific cells from Excel into SQL Server
Posted by J at 3/9/2007 3:30:08 PM
Hello. Sorry but I'm not sure where to ask this question but was wondering if anyone could advise me the best way of importing data in a named range or specific cells from Excel into SQL2K? Thanks in advance. J ...more >>

Eliminating CRUD procedures
Posted by Colin Robinson at 3/9/2007 3:08:21 PM
Your know the ones, you have a table and it has Create,Read,Update and Delete Stored procedures and the app always uses these to talk to the DB eliminating dynamic sql in your apps. Makes perfect sense when you have a table however when you have 500 tables its not so clever (thats 2000 st...more >>

The SP is processing very slow .
Posted by at 3/9/2007 2:35:21 PM
I have stored procedure that process very slow . the job runs every minute and execute the SP after it does update stats on the ChangeQueue table and recompile the SP. The SP is processing very slow . any HELP Please Thankjs! EXEC dbo.C1_ProcessChangeQueue NULL, NULL, NULL, 10000, 0 The...more >>

Strange error
Posted by Mark Goldin at 3/9/2007 2:21:06 PM
My program has recieved this error from SQL 2005: Error: Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark after the character string ''. SQL Command: select * from udf_CheckDups(18100, ' L8Qla', 8975) If I execute it works fine. Can someone help, pleas...more >>

USE <Database> is case sensitive?
Posted by Michael She at 3/9/2007 1:50:32 PM
Hi all, We loaded our DB onto a customer database and we noticed that certain commands (i.e. USE DATABASE) is case sensitive. On our internal DBs, this is not that case. Does anyone know what flag we can set to disable case sensitivity? Thanks! ...more >>

Trigger on condition (data)
Posted by Test Test at 3/9/2007 1:49:23 PM
I need help to set a condition (based on data) on an update trigger. Do an instert to table B only if it meets this condition on table A i.e. " select * from A where color = 'red'" create table dbo.A (id int, color varchar(20)) create table dbo.B (id int, color varchar(20)) insert i...more >>

About rownum in sql server
Posted by Iter at 3/9/2007 1:05:13 PM
Hi Guys, In sql server there is not rownum like oracle, if I want delete rows less than a number, is there any efficent way to delete? Also, how about goto statement, is that ok to use it? I mean is there any limitation to use it? Thanks....more >>



Select Query to ouput to a new table
Posted by Vladimir Cepeda at 3/9/2007 12:36:03 PM
I'm trying to clean up a database that has a lot of duplicates from an update attempt by the previous technician. Some rows are duplicated as much as 20 times, some only 5-10 times, etc... So i ran this query to see duplicates. SELECT CONTACT, COUNT(CONTACT) AS NumOccurrences FROM [...more >>

parameters...
Posted by Brad Pears at 3/9/2007 12:32:50 PM
Can you use 'optional' parameters in an SQL server 2000 stored procedure?? I have a situation where some of the parameters may be 'nothing' when the stored procedure runs. It always fails when this happens as it assumes that I did not pass a required parameter. Help! ...more >>

Keep SELECT lock during transaction
Posted by sqlboy2000 at 3/9/2007 12:10:15 PM
I'm looking for some input as to best practice for accomplishing the following: I have a table with say a thousand records. Each record contains a status flag column. I have a process which comes along every so often and grabs any records where the status flag is 'New'. It then does some thin...more >>

TOP (n) PERCENT Problem
Posted by Ryan Buschert at 3/9/2007 11:31:24 AM
I'm running into a problem in SQL 2005 with an incorrect number of rows being returned from a TOP (n) PERCENT query in some cases. The example below illustrates the problem. I think it should only return 21 rows (75% of 28 is 21) but it actually returns 22 rows. Note, in SQL 2000 21 rows ar...more >>

get quarter and week from date
Posted by Jonn at 3/9/2007 11:20:07 AM
I have a table that list dates such as 2006-03-28, how can I get the week and quarter from this so if i have dates such as 2006-03-28 2006-03-1 2006-03-15 2006-10-10 2006-10-05 how can I return that week and what quarter that month is in? ...more >>

READPAST lock
Posted by Mark at 3/9/2007 10:28:54 AM
I have an application that is calling the T-SQL in a procedure below. The app (not SQL Server) is complaining "You can only specify the READPAST lock in the READ COMMITTED or REPEATABLE READ isolation levels." Could someone suggest a work around? The code below attempts to identify a reco...more >>

Querying a Subscription [SQL 2005]
Posted by mike.aarset NO[at]SPAM gmail.com at 3/9/2007 10:19:36 AM
So I set up a "Replication/Local Publication" on a Production SQL 2005 Database. It publishes a Database on the production database. I then set up a "Replication/Local Subscription" on another Database we call "Report Database" that will have reports running on it and querying the Subscriptio...more >>

select for update
Posted by jeffchirco NO[at]SPAM gmail.com at 3/9/2007 10:11:55 AM
I am a Oracle DBA new to SQL Server. We actually have a small MSDE database running here. How do I select records for update so if somebody tries to updates I have locked they will get an error. In Oracle I would just do: select column1 from mytable for update In sql server I try to do th...more >>

Table Layout Suggestions
Posted by Nate at 3/9/2007 9:41:23 AM
I am looking to create an employee schedule table, which will contain the following information: The employee's name The shift start time The shift end time We are a 24 hour operation, so I will have shifts that begin on one day and end on another. I assume I'll need a shift_start_date and...more >>

Compare a query with a table row
Posted by tarheels4025 at 3/9/2007 8:55:03 AM
Below is the query I have so far. Here is what I am trying to accomplish. I want to run the query, which is after the where, using the financial_message table. I then want to take the table store , which contains all of the stores possible and compare the query results against that row. Is...more >>

Select "top" partitions SQL2005
Posted by tcs at 3/9/2007 8:41:05 AM
My question revolves around performance. I would like to know how SQL Server 2005 will react to the following: Let's say I have 60 one day partitions based on time. I would like to "select top 1000" XXXXXX. If the data for my query is in partition 55. Would the query then have to vis...more >>

Grab text of update query in trigger
Posted by MikeG at 3/9/2007 8:37:03 AM
I have been putting together my first ever trigger and it has gone well. I am essentially recording changes made to a table for auditing purposes. However, I created it on a table of a third party app over which I have no access to the code. One of the things I want to record is from which ...more >>

SQL compile error not trapped
Posted by Bijesh at 3/9/2007 8:24:00 AM
Hi All, I am facing a wierd problem condition where SQL compiler is not trapping compile/run time error. Here is an example to illustrate: Create Table Table1 ( Col1 INT ) Go Create Table Table2 ( Coll1 INT --Note an extra "L" in the column name. ) Go Now fire this query: Select * ...more >>

Suggestions for Data Model
Posted by Duke Carey at 3/9/2007 7:01:41 AM
Disclosure: I'm an Excel user more than anything, with rudimentary SQL skills and some Access experience I need some help with the logical structure of a database for my wife, who is volunteering for a nonprofit (so the database is really for the nonprofit, I suppose) They need a means t...more >>

Stored Proc Help.
Posted by Mangler at 3/9/2007 6:59:41 AM
I have a query that is going to be on an ASP page, but I am not sure how to get it on there because its not an ordinary select statment. I though about doing a stored proc but not sure how to do that either. Below is the query, anyone have any suggestions? or should I be posting in an ASP grou...more >>

Execute SQL Task - Problem Using an Input Variable
Posted by gdunnjr at 3/9/2007 6:01:24 AM
I have an execute SQL task with an OLEDB datasource. I want to pass in an input string and execute some sql using the string. It seems that there are limitations on what you can do with the input variable. Using the SQL Statement below, it works fine: select count(*) from test_code_source...more >>

Need a suggestion
Posted by Mangler at 3/9/2007 5:51:27 AM
I have to create a web site and a database for a company. Thats easy, the part I am running into issues trying to figure out is I wont have access to their system. To get the data from their internal system into the database to where the web site will be accessing has got me stumped. What the...more >>

Need help with syntax
Posted by peter.fredrikson NO[at]SPAM extenda.se at 3/9/2007 4:24:17 AM
I want fo put the result of a function call in a parameter to a stored procedure without having to use an intermediary variable like: exec spname @somvariable1, dbo.somefunc1(@somevariable2) --This returns the error "Incorrect syntax near '.'." I know I can do it like below, but if there is a ...more >>

Insert Advice
Posted by Russell Mangel at 3/9/2007 3:40:27 AM
Hi, I am using SQL Server 2005 (Standard), and the client is using VS2005 C#. Question: Can you improve my stored procedure? I don't like using @@ROWCOUNT for COMMIT TRANSACTION. Maybe it would be better to write 3 stored procedures, and use them inside another SP? How should this be done...more >>

distinct / group by / having
Posted by Lee at 3/9/2007 3:22:19 AM
My data table has 4 million records, each record is assigned a business ID based on the company, so its possible some records have the same business ID. My query needs to return just one from each business ID (it doesn't matter which one at this stage -the first occurrence will be fine) as ...more >>

online restore in 2005
Posted by prince at 3/9/2007 2:59:03 AM
Hi, Is the restore of a database in SQL 2005 is online by default or is there any special procedure to make the restore of a database as online? thanks and regards prince ...more >>

xp_cmdshell: what constitutes an error?
Posted by David Wimbush at 3/9/2007 2:29:57 AM
Does anyone know, please, what triggers xp_cmdshell to decide that what it just executed errored? Books Online says "If xp_cmdshell is executed within a batch and returns an error, the batch will fail. This is a change of behavior. In earlier versions of Microsoft SQL Server the batch would cont...more >>

Delete character bottom string
Posted by ciupaz at 3/9/2007 1:57:05 AM
Hi all, I have some strings like these: aa/aa// // aa// 4/5/6/7 I want delete the character "/" when is at the bottom of the string, or the string is only /. So to obtain: aa/aa Null aa 4/5/6/7 How can I get this? Thanks a lot. Luigi ...more >>

To store result of stored procedure in a local variable
Posted by Priya at 3/9/2007 1:10:04 AM
Hey all, I have a query which returns the name field from a table. I use the sp_executesql to execute this query. The code looks like, SET @Query = 'SELECT ' + @TableName + 'Name' + 'FROM' + @TableName + ' WHERE ' + @TableName + 'ID = ' + @ID EXEC @Name = sp_executesql @Query SELECT @Name...more >>

Management Studio Version 9.00.3042.00, Stop respond to Enter?
Posted by mtczx232 NO[at]SPAM yahoo.com at 3/9/2007 12:53:43 AM
Frequently it's stop respond to Enter and Backspace key while browsing Object. have some one with such experience? ...more >>

@@ServerName
Posted by Mark at 3/9/2007 12:00:00 AM
Is there a T-SQL mechanism for capturing the name of the client pc that is executing a stored procedure? I was hoping for something like @@ServerName but specific to the client. Thanks, Mark ...more >>

Slow Insert performance on SQL Server!?
Posted by Frank Osterberg at 3/9/2007 12:00:00 AM
I want to insert as many records into a table as fast as possible using a C# and ODBC (or OLE DB, if there is a benefit). I want to use SQL Server, but currently MySQL with InnoDB is currently much faster, what am I doing wrong? I tried a few things, first I have tried used BeginTransaction a...more >>

Statistics - Catalog Information on SQL2000
Posted by Peter Shin at 3/9/2007 12:00:00 AM
Hi I'm looking for some catalog tables/views in SQL2000 that will give me information about my user-created statistics. I managed to get some information from sysindexes where (status & 64) > 0 so I can join with sysobjects and get the stats for a given table. However there are no entrie...more >>

Split Proc
Posted by obelix via SQLMonster.com at 3/9/2007 12:00:00 AM
olá Need to split funds from Funds_Pool tbl based on availability and priority in Allocation_Pool tbl. What may be allocated from the Funds_Pool depends on the alloc% e.g even though quantity is 100 in Allocation_Pool tbl if alloc% is 50 then only 50 can be allocated from that pool, also which...more >>

SOMEBODY TALK TO ME
Posted by obelix via SQLMonster.com at 3/9/2007 12:00:00 AM
Just need some pointers only ... not good at this thing. Need to split funds from Funds_Pool tbl based on availability and priority in Allocation_Pool tbl. What may be allocated from the Funds_Pool depends on the alloc% e.g even though quantity is 100 in Allocation_Pool tbl if alloc% is 50 th...more >>


DevelopmentNow Blog