Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
CREATE TABLE [dbo].[test]( [id] [bigint] IDENTITY(1,1) NOT NULL, [case_id] [bigint] NOT NULL, [comment] [varchar](50) NOT NULL) ON [PRIMARY]
The idea here is that I should get a new Case ID if I just create a row with NULL as case_id. However, if I specify a previous Case ID I should just add a new row with the specified ID and the comment (just add a comment to an existing case).Do I need to create two stored procedures, or is it possible using just one?
divyaram
Posting Yak Master
180 Posts
Posted - 2009-12-28 : 08:08:22
Hi tiwas, its possible to do it in single SP you have to check the condition for case_id if it ther in the test table then command should be existing case else as its a new oneRegards,Divya