aspose file tools*
The moose likes JDBC and the fly likes How can I make this stored procedure work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How can I make this stored procedure work" Watch "How can I make this stored procedure work" New topic
Author

How can I make this stored procedure work

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
Im using MSSQL 2000 im trying to write a stored procedure which first checks if a certain day
is already stored if not store the day and the owner and return something to show if it was stored
or not
create procedure dbo.pickDay @day datetime, @owner varchar(255), @number tinyint
AS
IF EXISTS
(SELECT day FROM calendar
WHERE [date] = @day)
INSERT INTO calendar([date], owner, number)
VALUES (@day, @owner, @number)
RETURN 1
ELSE
RETURN 0
GO
What am I doing wrong???
Thank you all for your time
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
ok i got it to work. My problem now is since my procedure does not return a result set, how can I find out if any records where added to the table.
I hope im explaining myself correctly...
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
in the MSSQL queury analizer once the stored procedure is called it returns a message like "1 record(s) affected" is there anyway to read this message once the stored procedure is called without having to resort to a SELECT * FROM
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
yes i understand but I am calling this stored procedure from within my java code so i think
this is the right place if any to bring up this question
 
 
subject: How can I make this stored procedure work