You can't use if. Use case
SELECT
logdate as CSTlogdate,
datepart(hour,logtime) as CSTLogHour,
TrafficOrigin = CASE
WHEN [c-ip] ='xxx.xxx.xxx.xxx' THEN 'internal'
ELSE 'external'
END
FROM [filterPageViews]
-----Original Message-----
From: Eric Dawson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 19, 2001 2:59 PM
To: CF-Talk
Subject: ifs inside a select inside a Stored Procedure
I want to do this but can't seem to find the right syntax. I am sure
Alter Procedure [_process Daily Page Views]
As
Insert into [processPageViews] (CSTLogDate,CSTLogHour,TrafficOrigin)
(
SELECT
logdate as CSTlogdate,
datepart(hour,logtime) as CSTLogHour,
if [c-ip]='xxx.xxx.xxx.xxx'
begin 'internal' as TrafficOrigin end
else
begin 'external' as TrafficOrigin end
FROM [filterPageViews]
)
return
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists