Viewing 13 posts - 1 through 14 (of 14 total)
Probably the code fails in following block:
SET @resultMessage = 'ticketID ' + CAST(@ticketID AS NVARCHAR(200))
+ ERROR_NUMBER() + '. ' + char(13) + char(10)
+ ERROR_MESSAGE() + '. ' + char(13) +...
June 3, 2009 at 1:45 pm
Hi Vishal,
You're using variable @sqlstring now, but it's not necessary (it makes the code harder to read). But if it works it works...
Still, I believe it can work as follows:
FETCH...
June 3, 2009 at 12:23 pm
Change the "PRINT @sqlstring;" part in "EXEC (@sqlstring);" or copy/paste output (Message tab) and exec.
June 3, 2009 at 7:14 am
You can solve it by using a cursor, like this:
DECLARE @sqlstring VARCHAR(MAX);
DECLARE @s-2 VARCHAR(1000);
DECLARE @cur CURSOR;
SET @sqlstring = '';
SET @cur = CURSOR LOCAL FOR
SELECT DISTINCT 'EXEC(''ALTER TABLE [' + ss.name...
June 2, 2009 at 3:06 pm
Sorry. Did not read the complete post. Iยดve deleted my answer.
May 18, 2009 at 6:42 am
Hopefully this will clarify the problem:
USE tempdb;
go
CREATE PROCEDURE dbo.sp_test ( @val VARCHAR(50) ) AS PRINT 'OK: ' + @val;
go
EXEC dbo.sp_test JohnSmith;
go
EXEC dbo.sp_test John Smith;
go
EXEC dbo.sp_test 'John Smith';
go
So, use quotes. But...
May 13, 2009 at 1:31 am
Don't press F5 too often or it will break ๐ Glad I could help.
May 7, 2009 at 1:24 am
I think the problem occurs here: firstname=substring(name,1,charindex('+',name)-1)
Whenever there is no "+" in the name column, the command will look like substring(name,1,-1).
Check existance of "+" first, before using the substring function.
May 7, 2009 at 1:22 am
If the tbl_Details.UpdateDate is NULL, the result will be NULL also. If tbl_Details.UpdateDate is an empty string, the result will be 1 jan 1900.
Try: Convert(datetime,CASE WHEN tbl_Details.UpdateDate = '' THEN...
May 7, 2009 at 1:15 am
The way I read it: Execution time is 31ms instead of 41000ms. That's a big difference! ๐
May 6, 2009 at 7:54 am
I dont't know the datamodel, but perhaps you can remove the DISTINCT in the CTE for further optimization?
May 6, 2009 at 5:48 am
Read this article by Hugo Kornelis to get some answers: http://sqlblog.com/blogs/hugo_kornelis
May 6, 2009 at 4:54 am
Perhaps you can try this one?
WITH AccessDenied( CardIdentifier ) AS
(
SELECT DISTINCT CardIdentifier
FROM
CardCollection...
May 6, 2009 at 4:07 am
Viewing 13 posts - 1 through 14 (of 14 total)