Viewing 15 posts - 46 through 60 (of 64 total)
Looks like I've got imbedding a variable into the script on the brain. Here is a different example with a more complex selection logic, but no variables.
use Northwind
declare @i int,@sql...
June 10, 2005 at 10:06 pm
Someone mentioned using a temp table, but didn't give an example.
use Northwind
declare @i int,@sql nvarchar(2000)
create table #tmp (i int)
set @i=-1
set @sql = 'declare @i int
SELECT @i=MAX(CategoryID) FROM dbo.Categories...
June 10, 2005 at 9:50 pm
1. It helps if you have valid XML. I parsed yours into an XML file and found several errors. Searching for & should find several occurances of bad attempts to...
June 6, 2005 at 8:44 pm
That length of variable bug is sometimes hard to find. I had a varchar(8000) field truncating to 4000 characters. As soon as I cast all of my nvarchar variables I was...
June 6, 2005 at 7:10 pm
"COUNT(*), on the other hand, does not eliminate NULLs."
Actually, COUNT(val) will always eliminate nulls, but * includes all fields in the table and by definition is not null and will not be...
June 6, 2005 at 6:55 pm
Another place to watch out for
... WHERE field NOT IN (SELECT field2 FROM tbl)
If field2 ever has a null value, this will always result in no selections. It's funny, if...
June 3, 2005 at 4:43 pm
FYI sql like 'customerid = ' & sCustomerID
Can be 'isnull(customerid) = isnull(' & sCustomerID & ')'
or it can be '(customerid is null and ' & sCustomerID & ' is null)...
June 3, 2005 at 4:36 pm
1. The master database that ships with sql2000, why is it there and what is the main purpose of it?
Believe it or not, SQL existed for years before MicoSoft was...
June 2, 2005 at 1:34 am
A "one to many to ONE seperation table" is what I call a bridge table, others call it a link or linking table. This bridge table will have keys from...
June 1, 2005 at 4:56 pm
if NOT exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_DisplayTableRelation]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
exec sp_executesql N'CREATE procedure usp_DisplayTableRelation AS print 1'
if NOT exists (select * from dbo.sysobjects where...
June 1, 2005 at 3:01 pm
Sorry about the double spacing. That's this posting routine getting involved.
June 1, 2005 at 2:59 pm
if NOT exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[usp_DisplayTableRelation]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
exec sp_executesql N'CREATE procedure usp_DisplayTableRelation AS print 1'
if NOT exists (select * from dbo.sysobjects...
June 1, 2005 at 2:58 pm
I immediately blew up on a recursive loop count error, basically because your code can put the table references in an infinite loop. Here's an extract of the output after...
June 1, 2005 at 2:57 pm
1. If two products have the same max width/height, you can't store them both with the primary key given in the example. It may be better to create a new...
May 31, 2005 at 2:28 pm
If you are going to use custom types, while you are at it, make your date part an int field to save 4 bytes of storage there as well.
I have...
May 31, 2005 at 1:21 pm
Viewing 15 posts - 46 through 60 (of 64 total)