How to make a member ID ? i want to join 0000, id (autoincrement), DateTime.day, datetime.years(2)
example : Id ={1,2,..}
DateTime= {01/08/2015}
so i have member ID = {000010115,000020115,...}
if you have solution please teach me
thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amitesh VermaPosted Aug 12, 2015, 7:40 AM
select @yearvalue=right(DATEPART(YY,GETDATE()),2)
print @yearvalue
select @Identitydate=IDENT_CURRENT('tablename')
print @Identitydate
set @newid='000'+''+cast(@Identitydate as varchar(5)) +''+cast(@yearvalue as varchar(5))
select @newid