| Author |
Topic  |
|
|
mikedu
Starting Member
9 Posts |
Posted - 06/08/2012 : 15:13:12
|
I have (what should be) simple insert into an error table. If count's from two different tables don't match, I want to insert values. The top portion is fine but I am getting an error on my insert statement. ('incorrect syntax near where')
Any ideas?
declare @notes integer; declare @sql integer; set @notes = (select COUNT(*) from tblPG_Notes_Validation); set @sql = (select COUNT(*) from tblPG_Sql_Validation);
INSERT INTO tblPG_Errors VALUES (1, 'Total Count doesnt match', GETDATE()) where @notes <> @sql
|
|
|
tkizer
Almighty SQL Goddess
USA
35007 Posts |
|
|
tkizer
Almighty SQL Goddess
USA
35007 Posts |
|
|
mikedu
Starting Member
9 Posts |
Posted - 06/08/2012 : 15:40:37
|
Thanks tara, the last 2nd option was exactly what I was looking for but couldn't think of....must be a friday afternoon thing...
|
 |
|
|
tkizer
Almighty SQL Goddess
USA
35007 Posts |
|
| |
Topic  |
|