Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if then else

Status
Not open for further replies.

pscassidy

Programmer
Joined
May 6, 2003
Messages
2
Location
GB
hi,

i get

incorrect syntax near 'then'

when i use this code:

Alter Procedure intranet_property_list

@orderby1 varchar(20),
@orderby1_direction varchar(4),
@orderby2 varchar(20),
@orderby2_direction varchar(4)

As
declare @sql varchar(100)
if @orderby1=@orderby2 then @sql="test"
select ref,county,estate_agent,short_description,price_punt,feature,no_bedrooms,category,address1
from properties
order by ref desc
return



 
try without when, as in C++ Ion Filipski
1c.bmp


filipski@excite.com
 

Check answer in thread183-129212 of SQL Server forum. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
Does your SQL have 'CASE' ?

bobh
 
is a mistake, I would print then instead of when Ion Filipski
1c.bmp


filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top