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 |
|
andrthad
Starting Member
19 Posts |
Posted - 2006-01-22 : 00:15:34
|
| hi all,I am not sure why this state is not working. Would you please explain why and tell me of a fix.INSERT tblRevHistory (dteDateLogged, NoProdNumbers) VALUES(getdate(), SELECT Count(*) FROM weblogin.tbl_MASTER) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-01-22 : 00:54:39
|
use of VALUES does not allow subqueries. Change to SELECT instead.INSERT tblRevHistory (dteDateLogged, NoProdNumbers) select getdate(), (SELECT Count(*) FROM tbl_MASTER) -----------------'KH' |
 |
|
|
andrthad
Starting Member
19 Posts |
Posted - 2006-01-22 : 13:03:26
|
| Absolutely brilliant. Thanks. |
 |
|
|
nosepicker
Constraint Violating Yak Guru
366 Posts |
Posted - 2006-01-22 : 14:46:44
|
| Although, you don't need the second SELECT:INSERT tblRevHistory (dteDateLogged, NoProdNumbers) select getdate(), Count(*) FROM tbl_MASTER |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-01-23 : 02:41:55
|
| ordeclare @count intselect @count=Count(*) FROM tbl_MASTERINSERT tblRevHistory (dteDateLogged, NoProdNumbers) VALUES(getdate(), @Count)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|