开发者

how to function parameter take value automatically in sql server

i have create a table

infobool (
   book_id int identity(1,1) primary key,
   bid varchar(20),bname varchar(50)
 )

now i want use a function

dbo.book_id(@a int)
returns varchar(20)
as
begain
return 'bkid00'+convert(varchar(10),@a)
end

now how this function take automatica开发者_运维知识库lly value from book_id column


It looks like you are just trying to prepend a value to your book_id column? You can achieve that without a function, try something like this:

SELECT 'bkid00' + CONVERT(VARCHAR(10, book_id), bid
FROM infobool
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜