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 automatically 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.