I have a csv file that I am importing into an existing db. Contained within
the data are 6 fields, imageurl1 - imageurl6. I need to insert the data into
my dabase and store the number of images associated with the record. Right
now I have the below but am getting errors:

DECLARE @numPhotos int
SET @numPhotos = 0

SELECT ID,
IF ImageURL6 IS NOT NULL
BEGIN
SET @numPhotos = 6
END
IF ImageURL5 IS NOT NULL
BEGIN
SET @numPhotos = 5
END

...

ELSE
BEGIN
SET @numPhotos = 0
END

FROM cdmdatafeed

Any idea how I can return the correct number of images?

TIA,
Duane


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to