在sqlserver里,如何将两个字符变量衔接起来????????
在sqlserver里,如何将两个字符变量衔接起来????????
假如我有三个varchar变量
@a="ab"
@b="cd"
@c
请问我应该如何使得像c#语言那样@c=@a+@b即@c=“abcd”
------解决方案--------------------
SQL code
declare @a varchar(10),@b varchar(10),@c varchar(20)
set @a='a'
set @b='b'
set @c=@a+@b
print @a
print @b
print @c
--------------
a
b
ab
------解决方案-------------------- 探讨 SQL code CREATE PROCEDURE Fr_add ( @userid INT, @username NVARCHAR(50), @fid INT, @fname NVARCHAR(50), ) AS UPDATE MymyUsers SET FId=FId+CAST(@userid AS VARCHAR(20))+',',FName=FName+@username+',' where UserId=@fid GO 请问这个存储过程哪里出错了??
------解决方案-------------------- 探讨 SQL code CREATE PROCEDURE Fr_add ( @userid INT, @username NVARCHAR(50), @fid INT, @fname NVARCHAR(50), ) AS UPDATE MymyUsers SET FId=FId+CAST(@userid AS VARCHAR(20))+',',FName=FName+@username+',' where UserId=@fid GO 请问这个存储过程哪里出错了??