Advertisement
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: |
CREATE TABLE [dbo].[Session]( [sessionid] [int] IDENTITY(1,1) NOT NULL, [sessionname] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [year] [int] NOT NULL, [registration] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [startdate] [datetime] NOT NULL, [enddate] [datetime] NOT NULL, [active] [varchar](5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [lastupdate] [datetime] NULL, [lastupdateuser] [int] NULL ) ON [PRIMARY] CREATE TABLE [dbo].[ClassSchedule]( [classschid] [int] IDENTITY(1,1) NOT NULL, [classid] [int] NOT NULL, [sessionid] [int] NOT NULL, [sectionid] [int] NOT NULL, [instid] [int] NOT NULL, [fee] [money] NOT NULL, [web] [varchar](5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [onlinediscid] [int] NULL, [maxstudent] [smallint] NULL, [startdate] [datetime] NULL, [enddate] [datetime] NULL, [notes] [varchar](150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [status] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [createdby] [int] NULL, [createdate] [datetime] NULL, [lastupdateuser] [int] NULL, [lastupdate] [datetime] NULL ) ON [PRIMARY] CREATE TABLE [dbo].[Schedule]( [classschid] [int] NOT NULL, [day] [int] NOT NULL, [time] [varchar](12) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [createdby] [int] NULL, [createdate] [datetime] NULL, [lastupdateuser] [int] NULL, [lastupdate] [datetime] NULL ) ON [PRIMARY] Attempted Stored Proc code: AddNewSession ALTER PROCEDURE [dbo].[AddNewSession] -- Add the parameters for the stored procedure here @sessionid int OUT, @sessionname varchar(50), -- example: Summer 2008 @year int, @registration varchar(10), @active varchar(3), -- yes or no string @startdate datetime, @enddate datetime, @userid int AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; DECLARE @oldsessionid int DECLARE @createdate datetime SET @oldsessionid = (SELECT sessionid FROM Session WHERE active = 'yes') SET @createdate = getdate() IF (UPPER(@active) = 'YES') SET @active = 'yes' ELSE SET @active = 'no' -- Add new Session insert into [dbo].[Session] ([sessionid],[sessionname],[year], [registration],[startdate],[enddate],[active],[lastupdate],[lastupdateuser]) values (@sessionid,@sessionname,@year, @registration,@startdate,@enddate,@active, @createdate, @userid) SET @sessionid = SCOPE_IDENTITY() -- Insert new class schedule based on old class schedule INSERT INTO dbo.ClassSchdeule SELECT classid, @sessionid, sectionid, instid,fee,web,onlinediscid,maxstudent, @startdate,@enddate, notes, status, @userid, @createdate FROM dbo.ClassSchedule WHERE sessionid = @oldsessionid -- Now, insert new schedule based on new class schedule INSERT INTO dbo.Schedule SELECT @@identity, [day], [time], createdby, createdate FROM dbo.Schedule WHERE classschid = @classschid END |
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
|
Loading Advertisement... |