Hello,
This might be for someone who knows CF as well as sql.
I have a list coming in from a text box called ID:
SOH01123, SOH01146,SOH01141, SOH0118
With these values I have to run a select statement:
Select * from my table
where (UserID IN ('#form.id#'))
When I do this, sql wont work because it shows in sql as:
SELECT * from my table
WHERE (UserID IN ('SOH01123, SOH01146,SOH01141, SOH01185 '))
Surely this didn't work because it should be something like this:
WHERE (UserID IN ('SOH01123','SOH01146','SOH01141','SOH01185'))
To achieve the right where statement, I have to do a replace in CF to insert the ' in the right places.
Which I do like this:
<cfset myList=ListChangeDelims(MyList,"','",',')>
That replace worked perfectly when I did a cfoutput of mylist.
However my sql statement is now a mess. It looks like
SELECT * from my table
WHERE (UserID IN ('SOH01123'','' SOH01146'',''SOH01141'','' SOH01185 '))
Any help would be great.
Thanks
This might be for someone who knows CF as well as sql.
I have a list coming in from a text box called ID:
SOH01123, SOH01146,SOH01141, SOH0118
With these values I have to run a select statement:
Select * from my table
where (UserID IN ('#form.id#'))
When I do this, sql wont work because it shows in sql as:
SELECT * from my table
WHERE (UserID IN ('SOH01123, SOH01146,SOH01141, SOH01185 '))
Surely this didn't work because it should be something like this:
WHERE (UserID IN ('SOH01123','SOH01146','SOH01141','SOH01185'))
To achieve the right where statement, I have to do a replace in CF to insert the ' in the right places.
Which I do like this:
<cfset myList=ListChangeDelims(MyList,"','",',')>
That replace worked perfectly when I did a cfoutput of mylist.
However my sql statement is now a mess. It looks like
SELECT * from my table
WHERE (UserID IN ('SOH01123'','' SOH01146'',''SOH01141'','' SOH01185 '))
Any help would be great.
Thanks