Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ashoktheagarajan
Starting Member
2 Posts |
Posted - 2009-03-05 : 05:20:44
|
| ALTER PROCEDURE FindMaxDateofDataASBEGIN Declare @date datetimeEXEC ('Declare @datetime Use Coradiant Select @date = max(date) from Raw_data EXEC ('Use Metadatamgmt Insert into LastUpdateDates values(1,@date,00:00:00)')ENDWhat I am trying to do is to find out the maximum date till which the data has been downloaded. Coradiant is the name of the Data base and Raw data is the name of the table. Metadatamgmt is the name of the database where i have the lastupdatedates table where i input the last date till which the data has been filled. But when i try to execute these three statements, it says must declare variable @date. Please help |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-05 : 05:25:21
|
Why use exec when nothing is dynamic.Might as well change it to..CREATE PROCEDURE FindMaxDateofDataASBEGINDeclare @date datetimeSelect @date = max(date) from Coradiant..Raw_data Insert into Metadatamgmt..LastUpdateDates values(....)END |
 |
|
|
ashoktheagarajan
Starting Member
2 Posts |
Posted - 2009-03-05 : 05:29:58
|
| Thanks ! It worked. Also if i am not bothering you. Is there a way to find out when was the last insert made on a particular table. |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-05 : 05:31:09
|
| A few ways are listed here.http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=120939 |
 |
|
|
|
|
|