TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
amarnath reddy ambati
NA
43
8.1k
Auto Increment nvarchar Column in Sql Server 2008
Feb 4 2013 7:20 AM
create table Customers
(
dbID int identity not null primary key,
CustomerName varchar(100)
)
Go
create function CustomerNumber (@id int)
returns char(5)
as
begin
return 'C' + right('0000' + convert(varchar(10), @id), 4)
end
Go
alter table Customers add CustomerNumber as dbo.CustomerNumber(dbID)
Go
INSERT INTO Customers(CustomerName) VALUES ('Name')
INSERT INTO Car(CustomerID) VALUES (SCOPE_IDENTITY())
Go
Reply
Answers (
1
)
Error converting data type varchar to numeric
how to get value by passing multiples value in T-Sql ?