Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How can I make this stored procedure work  RSS feed

 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!