Give me a chestnut.
If object_id (N ' [dbo].[ Testforekoy_mission] ', N ' u ') is not null
drop table [dbo]. [Testforekoy_mission]
Go
CREATE TABLE [dbo]. [Testforekoy_mission]
(
[Mno] int identity (100001,1) not null primary key,
[mname] nvarchar () NOT NULL,
[Detail] nvarchar (500),
[Daterelease] Date,
[State] nvarchar (20)
)
Go
ALTER TABLE [dbo]. [testforekoy_mission] Add constraint df_testforekoy_mission_daterelease default (GetDate ()) for [Daterelease]
Go
ALTER TABLE [dbo]. [testforekoy_mission] Add constraint df_testforekoy_mission_state default ' not done ' for [State]
Go
If object_id (N ' [dbo].[ Testforekoy_uspmission_add] ', N ' P ') is not null
drop procedure [dbo]. [Testforekoy_uspmission_add]
Go
CREATE PROCEDURE [dbo]. [Testforekoy_uspmission_add]
@Mname nvarchar (20),
@Detail nvarchar (500),
@DateRelease date,
@State nvarchar (20)
As
Begin
SET NOCOUNT ON
INSERT INTO [dbo]. [Testforekoy_mission]
VALUES (@Mname, @Detail, @DateRelease, @State)
SET NOCOUNT OFF
End
Go
Grant execute on [dbo]. [Testforekoy_uspmission_add] to [Db_spexecute],[siteuser]
Go
If object_id (N ' [dbo].[ Testforekoy_uspstaffsecurity_update] ', N ' P ') is not null
drop procedure [dbo]. [Testforekoy_uspstaffsecurity_update]
Go
CREATE PROCEDURE [dbo]. [Testforekoy_uspstaffsecurity_update]
@Sno int =null,
@Password varchar (=null),
@Question nvarchar (=null),
@Answer nvarchar (=null),
@InputWrong int =null
As
Begin
SET NOCOUNT ON
Update [dbo]. [Testforekoy_staffsecurity]
Set [Password] = IsNull (@Password, [Password]),
[Question] = IsNull (@Question, [Question]),
[Answer] = IsNull (@Answer, [Answer]),
Inputwrong = IsNull (@InputWrong, Inputwrong)
where [Sno][email protected]
SET NOCOUNT OFF
End
Go
Grant execute on [dbo]. [Testforekoy_uspstaffsecurity_update] to [Db_spexecute],[siteuser]
Go
SQL build table, build SP