473,394 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Problem In This Code

8
Can anyone fix this for me. I know that I can achieve what I want using triggers but for some reason our DBA will not allow them. The first part of the code takes a weeks classes and inserts a carbon copy into the table a number of times using a paramater repetitions. On creation of each class there should be and insert into a sessions table and an insert into a slots table. Any help would be great.

CREATE PROCEDURE [dbo].[ins_multiple_weeks] @empNo char(8), @repetitions int, @startDte datetime

AS

SET NOCOUNT ON
SET DATEFORMAT dmy

DECLARE @counter int
SET @counter = 0

WHILE @counter < @repetitions
BEGIN
SET @counter = @counter + 1
print 'The counter is ' + cast(@counter as char)

INSERT INTO dbo.classes

SELECT
DATEADD(wk, @counter, class_dte) AS StartDate,
DATEADD(wk, @counter, class_start_time) AS StartTime,
DATEADD(wk, @counter, class_end_time) AS EndTime,
class_def_id,
getDate(),
@empNo,
modify_dte,
modify_emp_no,
is_deleted
FROM
dbo.classes

WHERE
(class_dte BETWEEN @startDte and DATEADD(wk,1, @startDte))

SELECT @@IDENTITY
INSERT INTO sessions(class_id, create_emp_no) VALUES (@@IDENTITY,@empNo)
INSERT INTO slots(session_id, slots, create_emp_no) VALUES(@@IDENTITY,10,@empNo)




END
GO
Dec 13 '07 #1
0 758

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Bruce W...1 | last post by:
In my effort to learn PHP I'm playing with some simple email scripts. They worked a few days ago but they stopped working. The only thing I've done to this Windows 2000 PC in this time was a...
21
by: BlackHawke | last post by:
My name is Nick Soutter, I own a small game development company (www.aepoxgames.net) making our first game (www.andromedaonline.net) in java. I am writing because we are having a very...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
3
by: Christopher M. Lusardi | last post by:
Hello, THE PROBLEM ----------- If I compile parts of my program with CC, and C, using extern "C" as appropriate it compiles without any errors, but it does a segmentation fault when I run the...
13
by: John | last post by:
Hi all: In my code I define a class with inline constructor. But it does not work. I describe the class as below: myclass{ public: myclass(int a, int b) { r1 = a; r2 = b;} protected:
18
by: bArT | last post by:
Hi! I have a problem with such situation. I have a class like below and have some pointers (ptr1 and ptr2). I dynamically allocate memory in constructor and I free in destructor. For one pointer...
9
by: babak | last post by:
Hi everybody I'm working with a project in embedded Visual Studio 4 and I have a general problem which I hope that somebody can help me with. My problem is the following: My project works fine in...
14
by: Harry | last post by:
Good Day, Here is a structure that i am using in my code typedef struct storable_picture { PictureStructure structure; int poc;
8
by: Rinaldo | last post by:
Hi, When I start my program in the debugger, there is no problem, but when not I get an exception. It appears in: private void Upload(string filename, string FTnaam) { MessageBox.Show("in...
6
by: pkchandra999 | last post by:
My Server OS : Centos 64 bit Apache version is Apache v2.2.9 Php Version : 5.2.5 I am providing feeds to my forum through RSS. The feeds are in html and those feeds will be parsed to bbcode...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.