Viewing 15 posts - 3,706 through 3,720 (of 5,394 total)
I'm afraid this can't be done. UDF cannot execute dynamic SQL.
Some possible alternatives:
a) Code it as a stored procedure
b) Use IF statements to code a distinct SQL for each table...
November 2, 2010 at 4:41 am
If the rebuild process takes 9 hours, this means it needs 9 hours.
If you stop it, it will start from scratch.
I suggest that you start using a different optimisation strategy,...
October 29, 2010 at 9:06 am
I had the same happening to me several year ago.
It turned out to be a port malfunction on the switch the server was connected to.
October 29, 2010 at 9:02 am
CREATE TRIGGER trg_Celko ON vw_SSC_PostList FOR AFTER INSERT
AS
-- Go read the documents, inline comments are for sissies.
IF EXISTS (SELECT * FROM inserted WHERE [Name] = 'CELKO')
BEGIN
DECLARE...
October 29, 2010 at 7:51 am
Try this:
SELECT CAST(DATEPART(hh,timer) AS FLOAT) + (CAST(DATEPART(mi,timer) AS FLOAT)/60)
FROM tblTimeRecorder
BTW, get rid of that "tbl" prefix on your tables before Joe Celko catches you...
October 29, 2010 at 6:41 am
Much longer than what? Another server? Compare the actual execution plans.
Do you get different plans? Compare indexes and statistics.
Which query? Can you post it? Can you post the actual execution...
October 29, 2010 at 6:19 am
eroness (10/29/2010)
This sort of works, but the datatype that Sql server suggest returns no whole numbers.
Suggest? No whole numbers? What do you mean?
Can you post the results you're getting and...
October 29, 2010 at 6:09 am
andrewd.smith (10/27/2010)
...but saves 1 addition operation.
Doesn't save a lot of headscratching 😉
Peso's code is incredibly smart. Full stop.
If there's one minor thing that can be criticized, personally, I prefer...
October 28, 2010 at 1:05 am
You can't.
See this: Using TRY...CATCH in Transact-SQL
Look for "Compile and Statement-level Recompile Errors".
October 27, 2010 at 4:35 pm
Nice one, Peso!
Well, I wouldn't say "simple", I would say "short" instead! 🙂
Very nicely done, as usual.
October 27, 2010 at 3:22 pm
Steve Jones - SSC Editor (10/27/2010)
- Finding/changing the default backup location
- scheduling a trace
- duplicating...
October 27, 2010 at 3:03 pm
Steve Jones - SSC Editor (10/27/2010)
I wonder if any of you would be interested in writing to fill holes? I keep finding posts here, and elsewhere...
October 27, 2010 at 10:45 am
Nice catch, Wayne.
An alternative way could be checking the results of DATEPART(weekday) for known dates and replace the constants 1 and 7 with the variables.
DECLARE @Sunday int, @Saturday int
SELECT @Sunday...
October 27, 2010 at 10:27 am
Gail has a superb blog post on the topic:
http://sqlinthewild.co.za/index.php/2007/11/27/parameter-sniffing/
October 27, 2010 at 8:56 am
Viewing 15 posts - 3,706 through 3,720 (of 5,394 total)