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 > october 2007 > threads for friday october 26

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

exporting to a file
Posted by Lord Kelvan at 10/26/2007 10:25:05 PM
tbh I don't know why I bother nowadays ok i have a trigger a nice trigger it is for horizontal partitioning it is 700 lines (really big database) so I am not posting it not that it is necessary the only valuable information it is acts on when a record is updated and a certain value is added...more >>


there seems to be some overhead between SQL Server 2005 and a CLR function written in C#. Why is this?
Posted by DR at 10/26/2007 9:25:14 PM
there seems to be some overhead between SQL Server 2005 and a CLR function written in C#. Why is this? I have a simple wraper around System.Diagnostics.Stopwatch.GetTimestamp() : public partial class UserDefinedFunctions { [Microsoft.SqlServer.Server.SqlFunction] public static lon...more >>

escaping single quote
Posted by Andy at 10/26/2007 8:47:40 PM
Hi, I call sql statement from c++ code using ADO. Is there a way to prepare sql query before execution to be sure there are no single quotes etc? thanks ...more >>

Query returns empty columns
Posted by Amy at 10/26/2007 8:12:50 PM
Hi, The query below returns sales made in 2007 and 2006 and works fine. However, if a client didn't have sells in 2006, the query returns empty fields (for 2007 as well). Can anyone pls tell me why? I think the problem is with the WHERE statement but cannot see it. TIA Amy SELECT * ...more >>

how to pass variable to nested query?
Posted by light_wt at 10/26/2007 4:30:00 PM
how to assign the @title global so the inner query, the 2nd select, will know what it is? thanks. declare @title nvarchar(100); set @title='testing'; select * from a where id=@title and (select * from b where id=@title);...more >>

ALTER Table script
Posted by David C at 10/26/2007 4:06:42 PM
On SQL 2005 I have a table where I want to change a column data type from int to money. When I save the script in mgmt studio it creates a temp table, drops current one and then renames temp table. Is there a way to just have it generate the ALTER script like it did in SQL 2000? Thanks. ...more >>

Microsoft Office Visio 2007 // Current Version that mimicks "For Architects" from previous years
Posted by sloan at 10/26/2007 3:23:04 PM
Before you say I'm in the wrong group (microsoft.public.sqlserver.programming), please read: Microsoft Office Visio 2007 Does anyone know if there is a version that allows TSQL DDL export, like the previous version... Enterprise Visio for Architects? As in..if you design a database in...more >>

If then else inside a cursor
Posted by DBA at 10/26/2007 2:55:02 PM
I need to be able to use either a case statement or an if then else command inside a cursor. Is that even possible? And it does have to be inside of the cursor. Here is the syntax: Case Statement: DECLARE CursorName CURSOR LOCAL STATIC FOR case when type='S' then select command else ...more >>



im trying to do a xquery hello world in sql server 2005 but i keep getting this error:
Posted by DR at 10/26/2007 2:20:55 PM
im trying to do a xquery hello world in sql server 2005 but i keep getting this error: select foo.query('return <z/>') as result from foo Msg 4121, Level 16, State 1, Line 3 Cannot find either column "foo" or the user-defined function or aggregate "foo.Query", or the name is ambiguous. ...more >>

Single Database or Multiple with synonyms
Posted by SoccerFan NO[at]SPAM community.nospan at 10/26/2007 1:36:00 PM
Should we consolidate all our databases into one, or continue using separate databases referencing common tables via synonyms? We have a single SQL Server, using 2005 Standard Edition, using a single SQL Server Instance. We have been creating a new database for each application we develop....more >>

getting max(colname)
Posted by Rick at 10/26/2007 1:07:14 PM
I have a SQL statement: SELECT * FROM mytable WHERE col1 = @col1 AND col2 = @col2 AND col3 = @col3 I've just found that of the multiple rows returned by this result set, we only want the single row where subm_no is the maximum subm_no. What's the best way to add that condition? My *b...more >>

Can old backups just be deleted?
Posted by Sandy at 10/26/2007 12:52:03 PM
Hello - My databases are being backed up nightly. I thought I had created a maintenance plan that would overwrite the old backup; somehow I have ended up with quite a few old backups for each database. Can I just delete the old ones? How do I get it to overwrite the last backup? -- ...more >>

computed column of type bigint supported?
Posted by Bruce at 10/26/2007 12:01:00 PM
I have a SQL 2005 table with four integer columns. I want there to be a computed column containing a calculation based on the other four columns. A create statement for a version of the table simplified for clarity might look like this: CREATE TABLE [TestComputed]( [Item1] [int] NOT NULL...more >>

SPID -2
Posted by Cory Blythe at 10/26/2007 10:04:03 AM
We have an development instance that is generating a ridiculous number of processes with id -2 causing blocks. Can anyone point me at, or give me, a summary of what might be causing these processes to end up -2 which I understand to mean Orphaned. Thanks Cory Blythe ...more >>

performance help for slow query
Posted by david at 10/26/2007 9:03:01 AM
I have a table that holds ratings for securities. I have a view that presents the most recent rating for securities for a particular rating agency. E.g. Moodys, S&P or Fitch. However my view is taking about 6 seconds with only 2.5 M rows. The execution plan indicates that the sort by rating...more >>

Parsing a delimited field
Posted by amj1020 at 10/26/2007 9:02:18 AM
I need to parse a field into three separte fields. CREATE TABLE [dbo].[History]( [Symbol] [varchar](50) NOT NULL, [Price] [money] NULL Insert into table HRds_Rott_Pan, 45 USG_Rott_Pan,34 Indonesia_Rott_Pan,58 QLD_Jap_Cape,90 My output needs to look like this: Symbol ...more >>

Search query
Posted by Bhupi Singh at 10/26/2007 8:46:45 AM
Hi. I need to know that how to write a search query that could be use to find information ina a databse. Thanks in advance. EggHeadCafe - .NET Developer Portal of Choice http://www.eggheadcafe.com...more >>

SQL equivalent For Loop
Posted by kw_uh97 at 10/26/2007 7:57:03 AM
Hello everyone I am not sure if this is an appropriate question here in this forum and I apologize if so. However, I have a chunk of code in C# that I would like to know if it is possible to translate or transfer the logic to T-SQL. See here is the code in C#: for (int i = 0; i <Table.R...more >>

how to add foreign key constraint to existing tables w/ orphans
Posted by light_wt at 10/26/2007 7:46:01 AM
hi, i am trying to come up a way to recreate foreign keys between tables. these tables didn't use foreign key in the past. i have tried exec sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' then alter table b add constraint fk_b_i_a_i FOREIGN KEY (i) references a(i) it did...more >>

Views And the Query that make them
Posted by BLAW at 10/26/2007 7:34:11 AM
I have a pretty decent query that is doing some Grouping, has a Union, and a lot of date calculations. If I have created a view from this table will my data update as the base tables change? ...more >>

How to export empty strings via bcp?
Posted by Christian Bühler at 10/26/2007 7:13:02 AM
Hi, I want to create a text file by using bcp to export a view. The text file consists of fields of fixed length. The view contains a varchar column. Some rows within this view contain an empty string in this varchar column. So far there is no problem. But when I run bcp, the empty strings ...more >>

Random ID Number?
Posted by Paddy Mac at 10/26/2007 6:01:57 AM
Hi, Is there a way to setup a random number generator in a SQL table? Say I want a 10 digit number which will be a unique reference number, and be randomly generated, how would I do this? I've only done increments in SQL. Thanks for your advice!! Paddy EggHeadCafe - .NET Developer Po...more >>

Pagination performance
Posted by David W at 10/26/2007 12:59:04 AM
I changed a stored procedure that does pagination from the top style to the bottom style - mainly to avoid errors in differences in the 2 queries (count and select) and for conciseness. The performance on a large table for the bottom query was amazingly bad. The query plan is very different ...more >>

sp_server_info
Posted by JWOL at 10/26/2007 12:43:51 AM
Hi, Does anyone know if it's possible to change the attribute values displayed by the system stored procedure sp_server_info? It would be useful to change some of these such as attribute 112 - sp_rename which would prohibit the renaming of stored procedures, as sp_rename bypasses any auditin...more >>

A bit of Syntax help, please
Posted by Mike at 10/26/2007 12:00:00 AM
I want to check to see if a record exists. If it does, I want to use its PK value in an insert. If it doesn't, I need to create it and get its PK for later use. I'm blindly thrashing around have have come up with the following: ALTER PROCEDURE [dbo].[AddAdverts] @AdvertTypeID int, ...more >>

integrate with VS 6.0
Posted by Mark at 10/26/2007 12:00:00 AM
Can sqlexpress integrate with VS 6.0?with VS2005? Regards Mark ...more >>

Database table design concept question
Posted by Jason Huang at 10/26/2007 12:00:00 AM
Hi, I have a C# windows form Form1. In the SQL Server 2000, I have 2 table, Product and ProductDetail. The tables Product and ProductDetail are as follows: CREATE TABLE Product ( [ID] [bigint] IDENTITY (1000, 1) NOT NULL , [Name] [char] (10) ) ON [PRIMARY] CREATE TABLE ProductDetail ( [...more >>


DevelopmentNow Blog