Viewing 15 posts - 5,881 through 5,895 (of 7,597 total)
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...
August 1, 2014 at 10:59 am
Eirikur Eiriksson (8/1/2014)
ScottPletcher (8/1/2014)
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...
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...
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...
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.
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...
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...
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....
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...
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...
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,...
July 28, 2014 at 11:51 am
Yeah, would have to see the main SELECT to know how to adjust the code properly.
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,...
July 25, 2014 at 3:59 pm
Yeah, I'm completely lost as to what the code is trying to code. And if the db is offline, you won't be able to access the view "sys.database_files" within...
July 25, 2014 at 3:13 pm
Viewing 15 posts - 5,881 through 5,895 (of 7,597 total)