February 13, 2009 at 10:40 am
Why does this return null?! How can I go around this problem? Thanks.
@path is a varchar and I would like to add underscore + record id to the end of it.
@path + '_' + cast (scope_identity() as varchar(10))
February 13, 2009 at 10:44 am
what does select @path return?
If @path is null the string returned from the concatenation will be null if SET CONCAT_NULL_YIELDS_NULL in ON.
February 13, 2009 at 10:47 am
@path is not null! I pass a value to @path. I have tested it. The value is passed.
procedure....
@path
..
begin
insert into mytable ([[Path])
values ( @path + '_' + cast (scope_identity() as varchar(10)) )
.......
February 13, 2009 at 10:50 am
Then scope_identity is returning null. Tried this, select scope_identity(), on my dev server, and it returned null.
I'd put an isnull() with a default value around your call to scope_identity and see it that is what is happening.
February 14, 2009 at 9:58 am
Scope_Identity() will be null until you actually do an INSERT.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply