Answer Posted / dipak patil
Create Table emp
(
dbID int NOT NULL IDENTITY (1,1) PRIMARY KEY,
customerNumber NVARCHAR(100) ,
Name Varchar(100)
)
GO
----------------------------------------
Create Proc Usp_InsertRecord
@EmpName Varchar(10)
As
BEGIN
Declare @MAXValue Varchar(Max),@intValue Integer
SET @MAXValue='0'
SELECT TOP 1 @MAXValue=ISNULL(customerNumber,0) From emp Order by dbID DESC
Set @intValue=Convert(Integer,Replace(@MAXValue,'Gt',''))+1
SET @MAXValue='GT' + right('0000' + convert(varchar(10), @intValue), 4)
Insert Into Emp(customerNumber,Name) Values(@MAXValue,@EmpName)
END
----------------------------------------
-- Exec Usp_InsertRecord 'RAM'
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between writing data to mirrored drives versus raid5 drives
How many types of triggers are there?
Do you know what are the steps to process a single select statement?
What stored by the msdb? : sql server database administration
What is sql server replication? : sql server replication
plss anybody specify tha constrian management system in dbms
How would we use distinct statement? What is its use?
What are the different types of lock modes in sql server 2000?
Define cursor locking
Why truncate is ddl?
Tell me what are the essential components of sql server service broker?
Explain how you can configure a running aggregate in SSRS?
How display code or Text of Stored Procedure using Sql query in Sql Server ?
What is the difference between TRUNCATE and DROP?
What is query parameter in ssrs?