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 |
bmanning100
Starting Member
7 Posts |
Posted - 2015-02-18 : 14:48:17
|
I need help. There is a syntax problem with code below.If (select CPUTM from [dbo].[System_Management_Facility] where CPUTM > '0:00:55.38') THEN PRINT 'GOOD'bm |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-02-18 : 14:49:49
|
What are you trying to do? Do you just need to print good if the select returns any data? If so, then here you go:If exists (select * from [dbo].[System_Management_Facility] where CPUTM > '0:00:55.38') THEN PRINT 'GOOD'Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
bmanning100
Starting Member
7 Posts |
Posted - 2015-02-18 : 15:03:27
|
Yes. But I keep getting error below. ERROR: Incorrect syntax near the keyword 'THEN'.If exists (select * from [dbo].[System_Management_Facility] where CPUTM > '0:00:55.38') THEN PRINT 'GOOD'bm |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-02-18 : 15:04:14
|
Sorry I missed that you had added THEN, so when I copied/pasted your code it was left in. It should be this:If exists (select * from [dbo].[System_Management_Facility] where CPUTM > '0:00:55.38') PRINT 'GOOD'Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
bmanning100
Starting Member
7 Posts |
Posted - 2015-02-18 : 15:51:03
|
Thanks tkizerbm |
|
|
|
|
|