Viewing 15 posts - 5,896 through 5,910 (of 7,613 total)
dkriplani97 (8/1/2014)
UPDATE TableA
SET Value = isnull((select top 1 Value from #tmpcopylibrary
where dataid = tempquerydataid), 0).
however this is not working
UPDATE TableA
SET Value = isnull((select top 1...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
August 1, 2014 at 11:11 am
OPENQUERY does not allow variables, only literal/static queries.
Try code below instead.
--temporarily add "TOP (100)" to the query for testing purposes
SET @tsql = STUFF(@tsql, CHARINDEX('SELECT', @tsql) + 6, 0, ' TOP...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
August 1, 2014 at 10:59 am
Eirikur Eiriksson (8/1/2014)
ScottPletcher (8/1/2014)
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
August 1, 2014 at 8:57 am
If the table may or may not exist, you'll have to make references to that table only in dynamic SQL. Otherwise, if the code runs and the table does...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
August 1, 2014 at 8:03 am
Agreed, nice code.
But if it's a birthday, wouldn't it be reasonable to use the current date + 1 as the cutoff, since there won't be future birthdates but someone could...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 31, 2014 at 5:38 pm
SQL Server provides a stored proc, "'sp_spaceused", to return space info. But annoyingly and frustratingly, it returns two separate result sets.
For my use, I cloned their proc, adjusting it...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 31, 2014 at 5:11 pm
Books should be more valuable than classes. Look for titles by Kalen Delaney particularly. For general SQL skills, look for Itzik Ben-Gan.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 31, 2014 at 3:57 pm
Shrinking the log file has absolutely no affect on the data indexes and their fragmentation. You would only need to check on index rebuilds if you shrink the data...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 31, 2014 at 8:03 am
I suspect it's because SQL's internal processing does "ON" clauses before WHERE clauses.
Therefore, I think they figure the ON clause might eliminate rows sooner than a WHERE clause, and avoid...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 30, 2014 at 3:55 pm
Sean Lange (7/30/2014)
ScottPletcher (7/30/2014)
Keith Tate (7/30/2014)
What can happen if null is not defined?
If you don't set the NULL option then it will be nullable.
create table Test1 (ExpirationDate datetime);
go
That's not true....
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 30, 2014 at 10:08 am
Keith Tate (7/30/2014)
What can happen if null is not defined?
If you don't set the NULL option then it will be nullable.
create table Test1 (ExpirationDate datetime);
go
That's not true. The default...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 30, 2014 at 9:44 am
matt6749 (7/28/2014)
With the Simple recovery model I'm using, would BEGIN TRANS and COMMIT statements help free up space in the log when used as...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 29, 2014 at 9:10 am
All clustered keys must appear in all nonclustered indexes. If you don't explicitly specify them, SQL will add them automatically.
I explicitly specify them when the index function requires them,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 28, 2014 at 11:51 am
Yeah, would have to see the main SELECT to know how to adjust the code properly.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 28, 2014 at 11:48 am
Generally, you prefer 10ms or less, although up to 20ms is ok. Anything over that is poor and progressively getting worse, of course.
Again, in general, 100ms is not acceptable,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 25, 2014 at 3:59 pm
Viewing 15 posts - 5,896 through 5,910 (of 7,613 total)