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 > august 2003 > threads for friday august 22

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

Alter table
Posted by Manoj at 8/22/2003 11:39:51 PM
Hi... i want to alter table using query analyser, and i want to change the data type from numeric to numeric identity. after this command - "alter table new_khasra_details alter column khasra_id numeric IDENTITY " it gives the following error--- Server: Msg 156, Level 15, State 1, Line ...more >>


Unexpected SQL syntax error!
Posted by Edward Yang at 8/22/2003 8:17:27 PM
I found that if you do not include any effective SQL statement (excluding comment), SQL Server 2000 Query Analyzer will think it is an error: Server: Msg 156, Level 15, State 1, Line 6 Incorrect syntax near the keyword 'end'. if 1=1 select getdate() else begin --select 'ok' end Is th...more >>

stored procedure much slower then same query
Posted by Test at 8/22/2003 8:16:54 PM
Hi, I have a select query that usesjoins, union and order by, the query uses only selects no inserts/updates nor deletes. when run as an SQL batch it produces results for about 40 secs. When I put the same query into a stored procedure and I run the procedure ( source is the query and nothin...more >>

parameterized sql scripts
Posted by Pierre at 8/22/2003 4:34:39 PM
During the installation of our project we want that the end-users to be able to rename the database. We generated the sql scripts for the default database schema. But for renaming the database object we want to use parameter values instead of the hardcoded database name in the scripts. Is it som...more >>

Question about the behavior of DISTINCT
Posted by Jason Carlson at 8/22/2003 4:05:40 PM
Hello all, I have a question about using the DISCTINCT Keyword. Does anyone know which record it takes... the first occurence? If so, does it still exhibit his behavior over a sorted table? For example, if one finds him/herself in a situation where one must select one record from the many s...more >>

Baffling stored procedure problem
Posted by Bob Frasca at 8/22/2003 3:37:31 PM
I get the following error when I run the query pasted below it. As you can see, I'm not referencing anything called 'Col1047'. I'm thinking this is a linked server issue but I'm really lost as to how to resolve it as the query isn't particularly complicated. Just as an aside. This error is ...more >>

How to concatenate strings across many to one relationships
Posted by Nick Stansbury at 8/22/2003 3:15:51 PM
Hi, Is it possible to use a select statement to return, for example, a userId and a single field containing a delimited string of all records that match in a second table. For example if we have Companies and People, is it possible to select coId and a sinlge field containing a single strin...more >>

Excel Report stops converting currency
Posted by alien2_51 at 8/22/2003 2:29:17 PM
At some point after running this report the "Wholesale Price" column data type in the excel spread sheet changes from Currency to General... It seems to ba around the 300th or so row but varies... This problem only occurs if the client is running Office XP.. And only in our production environment...more >>



Import from exel to sql server
Posted by bo at 8/22/2003 2:07:04 PM
Hi I've got exel xls file with a lot of data and i have to import it to Sqlserver. I've used DTS and ok I have a table with data but there is one column PASS/LOGIN and in that column i have both passwords and logins separeted with sign "/", i need separate them and export to another table ...more >>

parsing bug?
Posted by Bob at 8/22/2003 1:45:10 PM
this works ------BEGIN SQL------- CREATE PROCEDURE [tmpBug] AS DECLARE @SQL varchar(1000) SET @SQL = ' test ' SELECT @SQL ------END SQL------- this gives the error message Error 105: Unclosed quatation mark before the character string ''. Line 5: Incorrect syntax near ''. ------B...more >>

complex sql script?
Posted by Steve Moreno at 8/22/2003 1:11:41 PM
I need to write a script that a dbo can run against a database and it needs to do the following... Create a new Role 'ABC' Create another new Role 'DEF' Grant execute permissions to Role 'ABC' to all stored procs that begin with ABC. Grant execute permissions to Role 'DEF' to all store...more >>

suser_name() inconsistencies across servers
Posted by Steve H. at 8/22/2003 1:08:00 PM
Greetings! I am trying to pinpoint an issue a developer ran into. We have two different SQL Servers both running version 7.00.1063. They also both run on Windows NT 4. The problem we're having is that we have NT authenticated accounts on both servers. On the production server, the ...more >>

newbie - trigger - syntax
Posted by Chris Strug at 8/22/2003 12:57:40 PM
Hi, Further to my previous question on syntax, I have a question regarding the syntax of a trigger. This question is probably more to do with general TSQL syntax than triggers but please bare with me. I realise that this probably isn't the best design in the world but I figure its a good le...more >>

OPENQUERY(server, 'msdb..sp_help_job ')
Posted by A.M at 8/22/2003 12:53:46 PM
Hi, Why this query works fine with sp_who, but it doesn't work with sp_help_job ? SELECT * into #Tmp FROM OPENQUERY(<server>, 'msdb..sp_help_job ') It returns error: Server: Msg 7357, Level 16, State 2, Line 1 Could not process object 'msdb..sp_help_job '. The OLE DB provider 'SQLOL...more >>

Odd Datetime Query Error
Posted by nfalconer at 8/22/2003 12:45:27 PM
I am writing a simple sql statement to filter records based on a input date. The date is currently stored in a database as a varchar field, and changing this field to a datetime is not (currently) an option. This sql statement works fine without the WHERE clause, but with the where clause it beg...more >>

Dynamic WHERE statement
Posted by Jaap Terlouw at 8/22/2003 12:23:31 PM
Gents, Is there any way this would work, without using the EXEC() command? DECLARE @String varchar(100) SET @String = 'RoleID = 1' SELECT * FROM dbo.deldlrEmployeeRole WHERE @String Thanks in advance, Jaap Terlouw...more >>

TO CONNECT A DATABASE TO MSDE
Posted by Frank Dulk at 8/22/2003 11:52:44 AM
I have an application that uses MSDE as base of data. I already know as installing MSDE in my customer, however I am not getting to execute the command correctly to register the database in MSDE, without the aid of Access. I already read everything that had at the Forum, but even so I didn't get...more >>

Append Variable
Posted by CZ at 8/22/2003 11:30:45 AM
Friends, please, Could you help me? I have the next storeprocedure create proc miProc @sWhere varchar(50) select a.code, b.description from table1 a, table2 b where a.code=b.code + @sWhere When I run this with exec miProc " and a.code=321 " the results it's (0 row(s) affected), Pl...more >>

changing the current database within a stored procedure
Posted by Bob at 8/22/2003 11:27:20 AM
I prefer to keep raw SQL out of my code and in stored procedures, but some built-in SQL functionality ("create procedure", etc) only works in the 'current' database. Unfortunately, executing dynamically generated SQL to change the database with USE doesn't work within stored procedures, so I woul...more >>

Correct placement of SET XACT_ABORT ON
Posted by Rod at 8/22/2003 11:16:45 AM
One of my developers has used the T-SQL command SET XACT_ABORT ON (which I confess I was unfamiliar with) in his stored procedures. I have reason to believe that the transaction is failing, for one reason or another, to store the data. In looking at his code he had a statement like this: BEGIN...more >>

Top N rows
Posted by Scott Good at 8/22/2003 11:12:36 AM
How do you get the top N rows from a query where N is any number? I know I can do something like this: Select Top 100 ColA From Table1 but is there any way to do: Select Top N ColA From Table1 and assign N at runtime in some kind of stored procedure?...more >>

How to generate an incremental numeric value valid through all the session without insertions ?
Posted by Tim Conner at 8/22/2003 10:36:37 AM
I need to generate a incremental numeric value for a given user during its session. My system has a global operation identifier that is saved in each new record, update or delete operation on audit tables that is currently generated by inserting a value in a table with an identity column. I...more >>

Backup tables
Posted by Bob at 8/22/2003 10:31:12 AM
I thought I remembered back in the 6.5 days when you could backup just a table. Is that still possible? We have a database over 150 gigs and would like to run a dbcc reindex on some of our larger tables. Last time we did it in production, it blew out our logs and messed up our log shipping. We...more >>

Image Fields
Posted by Helen at 8/22/2003 10:12:32 AM
Hi, I would like to store Word templates in a image field in one of my tables. Are there any perfomance issues (speed etc on indexing) when including an image field in a main table, rather than putting it in a separate link table. Thanks H. ...more >>

index on table variable
Posted by sam at 8/22/2003 9:50:01 AM
Can we create index on a table variable? Thanks. ...more >>

Newbie: calling a UDF from a stored procedure HELP
Posted by john_s_geraghty NO[at]SPAM hotmail.com at 8/22/2003 9:29:40 AM
i have three tables: products,orders and orderlines and I want to make a procedure which will give the quantity of each product ordered under a given order number ( I still want the product to show even if there is no quantity). I need to first eliminate all the inappropriate rows from the order...more >>

Stored Procedure and Variables...
Posted by Michael Welz at 8/22/2003 9:15:24 AM
Hello, im trying to build a variables string for a stored procedure like this: .. .. .. SELECT count(*) AS ObjSNR FROM SD_Objekte WHERE SD_Objekte.ObjTyp IN (17,21,20) <<<<<< HERE IS THE Problem!!!!! AND SD_Objekte.ObjLSNr = @Liegenschaft AND SD_Objekte.ObjLage IN (1,...more >>

Question on Ownership chaining:
Posted by Koova at 8/22/2003 9:14:11 AM
CREATE TABLE XYZ.TABLE1 (col1, col2); CREATE PROCEDURE dbo.PROC1 AS SELECT * FROM XYZ.TABLE1; CREATE PROCEDURE dbo.PROC2 AS EXEC sp_excutesql N'select * from XYZ.TABLE1'; IF the login user X has rights to dbo.Proc1 & dbo.Proc2 and no rights on XYZ.TABLE1 then X can execute dbo.Proc...more >>

Trigger Q
Posted by Ricky at 8/22/2003 9:02:13 AM
In my table I have defined an insert trigger which updates a column (say columnX) after the records are inserted as while inserts ColumnX is left Null. So I have to grab certain values from other tables concatenate them and update that columnX from inserted table. I also have defined an ...more >>

Return Value from Stored Procedure
Posted by Scott at 8/22/2003 8:39:02 AM
I am having problems with a stored procedure not returning the @@identity to the ASP Page that called the stored procedure. Any ideas? The stored procedure is inserting the records, but I just cannot seem to get the identity. Here is the ASP and Stored Procedure. ASP: Set conn = Server.Cr...more >>

Views Collection
Posted by SDF at 8/22/2003 8:38:59 AM
I want to create a SP that is passed a View Name - but I can't use this variable as an object name within a Select statement. My question: Can I create a View object by querying the View Collection and use that object within the Select Statement?...more >>

Cascading Ref Integrity in 7.0
Posted by Rulle at 8/22/2003 6:30:16 AM
How can I obtain a "cascading referential integrity constraints" in SQL server 7.0? (delete rows with same foreign key) Thanks! ...more >>

IN vs, EXISTS
Posted by Dan at 8/22/2003 5:59:20 AM
What are the differences between using IN and EXISTS? They seem to be functionally equivalent so why have both? Are there any instances when you would want to use one instead of the other?...more >>

SQL Server 7.0 to 2000 upgrade
Posted by FH S at 8/22/2003 4:54:11 AM
Hi! I need help in upgrading SQL 7.0 (standard edition) to SQL 2000 (enterprise edition). The problem I am having is during installation the "upgrade" option is grayed out and if you proceed, it creates a new instance of SQL Server 2000. Is there any other way to do it? If not, then I underst...more >>

What is a merge join?
Posted by chrisk NO[at]SPAM cybase.co.uk at 8/22/2003 3:30:31 AM
I know this is obvious but what is a merge join and how does it differ from a normal join? Is this just jargon I have never come across before. And how does sorting take place in the two....more >>

Primary key or constraints in temporary table
Posted by Simone Greci at 8/22/2003 2:44:58 AM
Hi all, i'm using in some stored procedures a # table that contains a discreet number of records (about 70000). I choose to add a primary key to encrease performances ad that it happens. The code i used is the below: alter table #tmptree ADD constraint [pk_tmptree] primary key ( cNodeID, ...more >>

DTS & Trigger
Posted by Vax at 8/22/2003 12:10:58 AM
I all In my case, I use a DTS to import text data into Table and I have a trigger on this table to update a another table When i Test the trigger by a insert manualy, the trigger fire, but when the dts run , the trigger don't fire. Any ideas Thxs...more >>


DevelopmentNow Blog