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
Tell me what do you understand by a view? What does the with check option clause for a view do?
What is the parse query button used for?
How many columns can exist together per table?
What are the dmvs?
Where the sql logs gets stored? : sql server database administration
How to drop existing views from a database in ms sql server?
What is the language structure to add a record to a table?
Can sql servers link to other servers like oracle?
What are the tables in sql?
Mention the different authentication modes in sql server.
Why do you need a sql server?
Tell me in brief how sql server enhances scalability of the database system?
Explain left outer join and right outer join?
What are the diifferences between the ms sql server vs mysql?
How can windows applications connect to sql servers via odbc?