[SQL Server] Not asking for any parameters in stored procedure |
- Not asking for any parameters in stored procedure
- Calculate tables in a schema
- How to get the table name from a objectID?
Not asking for any parameters in stored procedure Posted: 15 Jul 2013 06:21 AM PDT I am creating a stored procedure to send an email when the status field in a table changes from Pending to Approved and eventid is the unique id for the events.I am using update command to change the status and capturing oldstatus and newstatus.But when I run the procedure, It is not asking for the parameters and when I execute it I am getting no result as it is not asking for any parameterPlease let me know what I am doing wrong.Thanks,BlyzzardBelow is the code: declare @EventId int declare @EventName nvarchar(500) declare @EventDate datetime declare @sstatus nvarchar(50) declare @oldstatus nvarchar(50) declare @newstatus nvarchar(50) select @oldstatus=sstatus from tblEvents where EventID=@Eventid UPDATE [tblEvents] SET [EventName] = @EventName, [EventDate] = @EventDate, [sstatus]= @sstatus, [Updateuser]=@Updateuser,UpdateDate=GetDate() WHERE [EventID] = @Eventidselect @newstatus=sstatus from tblEvents where EventID=@eventid --if oldstatus doesnot matches with newstatus then execute rest if @oldstatus <> @newstatus begin*****rest of the code******** |
Posted: 15 Jul 2013 03:21 AM PDT I need to calculate total # of tables in a particular schema.Its a user defined table.(Total number of tables seem a lot)I can view the schema id from select * from sys.schemas.Kindly advise. |
How to get the table name from a objectID? Posted: 14 Jul 2013 09:32 PM PDT HiI am trying to find the name of a table in our database given a objectID, when i run thisselect *from sysobjectswhere id = 632864I get no records returned. any ideas? I have got the objectID fromTable error: Object ID 632864, index ID 17051, page ID (1:28510200). The PageId in the page header = (55702:800)Thanks |
You are subscribed to email updates from SQLServerCentral / SQL Server 2008 / SQL Server Newbies To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment