Forums

This topic is locked

HELP WITH Stored Procedure

Posted 21 Jun 2002 02:42:25
1
has voted
21 Jun 2002 02:42:25 ilan co posted:
I NEED HELP I HAVE THIS sql
---------------
INSERT INTO [hadas].[dbo].[MAIN1]
SELECT [ID], [COURSE], [DATEFROM], [EXPDATE], [big] FROM [hadas].[dbo].[MAIN]
where id = 99999999
DELETE FROM [hadas].[dbo].[MAIN]
where id = 99999999
----------------------------------------
WHAT I WONT IS COVERT THIS SQL TO Stored Procedure
AND IN THE asp PAGE I WONT TO

Request("ID"
---------------------------------------------------------
WHAT IS NOT OK IN THE Stored Procedure
I NEED HELP TO fix IT




CREATE PROCEDURE [insert_MAIN_55] AS
(@ID [int],
INSERT INTO [hadas].[dbo].[MAIN1]
SELECT [ID], [COURSE], [DATEFROM], [EXPDATE], [big] FROM [hadas].[dbo].[MAIN]
where id = @ID
DELETE FROM [hadas].[dbo].[MAIN]
where id = @ID

GO

THNKS ILAN



Replies

Replied 21 Jun 2002 03:30:21
21 Jun 2002 03:30:21 b w replied:
Try removing the one bracket and put the as after the parameter @id. It is also easier if you tell us what problem you faced and your system. If it is SQL 2000 then you can use the check syntax. Also you can try to print out the variables that you want to test. ie
"PRINT CONVERT(NVARCHAR(4),@ID)"
and check this in Query Analyzer.

Just things from the top of my head.

CREATE PROCEDURE [insert_MAIN_55] @ID [int]
AS

INSERT INTO [hadas].[dbo].[MAIN1]
SELECT [ID], [COURSE], [DATEFROM], [EXPDATE], [big] FROM [hadas].[dbo].[MAIN]
where id = @ID
DELETE FROM [hadas].[dbo].[MAIN]
where id = @ID

GO



Replied 21 Jun 2002 08:07:58
21 Jun 2002 08:07:58 ilan co replied:
A BIG THNKS IT WORK
ONE little small help
I WONT TO ADD
---------------------------
IF EXISTS
WHERE
RETURN(1)
ELSE
RETURN(0)
-----------------
OR ROLLBACK TRANSACTION

thnks ilan

Reply to this topic