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
精彩评论