Ask a Question related to Coldfusion Database Access, Design and Development.
-
dj shane #1
Sproc Result as Comma Seperated List
Hey guys,
I had built some photoblogging software in the past and am currently just
revising it to bring it up to validated xhtml and running solely on stored
procedures.
At the beginning of the application, I initiliaze a session.list with ID's of
the photo entries. This is to control the next / previous functionality. I'm
doing this in cf right now, building a list with a loop of the result set. Is
there a way in SQL to build this comma seperated list in a SPROC, and just
bring that back to CF to manipulate.
Here's my code, but it's giving me an error.
DECLARE @EntryList varchar(255)
SET @EntryList = (SELECT Entry_ID
FROM V2_Entry
WHERE Active = 1
ORDER BY EntryDate ASC)
Error = Server: Msg 1033, Level 15, State 1, Line 5
The ORDER BY clause is invalid in views, inline functions, derived tables, and
subqueries, unless TOP is also specified.
dj shane Guest
-
Looping a list in SQL 2000 SPROC
Hey guys, just trying to learn something new today and wanted to convert one of my cf pages to a sproc. This page just sets up security for the... -
Comma displays in List?
Hi there, I've done a few searches and couldn't find this question posted yet, so please forgive me in advance if its a reapeat. I have an XML... -
comma delimited list problem
I have a comma delimited list that is loaded into flash using loadvars. How can I convert it into an array? thanks in advance. Shaun -
Splitting Comma delimited list
Hello everyone, I use the following to split a comma delimited list and get varying results and I don't understand why. my count of the... -
Reg. Perl script to read comma seperated file.
Hi, I do know how to read the comma seperated file using the following script while ($lines = <INFH>){ if ($lines =~ /^\s*$/){ last; } @flds... -
PaulH *TMM* #2
Re: Sproc Result as Comma Seperated List
dj shane wrote:
probably but wouldn't it be simpler to use valueList() on the returned resultset?> doing this in cf right now, building a list with a loop of the result set. Is
> there a way in SQL to build this comma seperated list in a SPROC, and just
> bring that back to CF to manipulate.
PaulH *TMM* Guest
-
SQLMenace #3
Re: Sproc Result as Comma Seperated List
This is how you do this kind of thing in SQl Server
--test in pubs to understand how it works
DECLARE @EntryList varchar(255)
SELECT @EntryList =''
SELECT @EntryList = @EntryList + au_fname +','
from authors where state ='UT' and state is not null
order by au_fname
select Left(@EntryList,len(@EntryList)-1)
then your would be something like this
DECLARE @EntryList varchar(255)
SELECT @EntryList = @EntryList + Entry_ID +','
FROM V2_Entry
WHERE Active = 1
ORDER BY EntryDate ASC
select Left(@EntryList,len(@EntryList)-1)
SQLMenace Guest



Reply With Quote

