DECLARE EmployeeList varchar(100)
SELECT EmployeeList = COALESCE(EmployeeList + ',', '') +
CAST(Emp_UniqueID AS varchar(5))
FROM SalesCallsEmployees
WHERE SalCal_UniqueID = 1
SELECT EmployeeList
I ran that code snippet through the SQL Query Analyzer after
customizing it for the pubs
DECLARE EmployeeList varchar(100)
SELECT EmployeeList = COALESCE(EmployeeList + ',', '') +
CAST(Emp_UniqueID AS varchar(5))
FROM SalesCallsEmployees
WHERE SalCal_UniqueID = 1
SELECT EmployeeList
I ran that code snippet through the SQL Query Analyzer after
customizing it for the pubs
you do this:
select convert(char(8),getdate(),112)
the third argument, 112, specifies the format: 20021009.
- Original Message -
From: S. Isaac Dealey [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, October 09, 2002 12:13 PM
Subject: Re: Return a Sub-Query as a Comma
.
This technique could really be useful if I could get it to go.
M
-Original Message-
From: Mark W. Breneman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 08, 2002 5:26 PM
To: CF-Talk
Subject: RE: Return a Sub-Query as a Comma Delimited List
You may want to look at this
http://www.sqlteam.com
Try using a datatype of NVARCHAR instead of VARCHAR. I seem to remember
running into this type of problem before...
HTH
Shawn Grover
-Original Message-
From: Dina Hess [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 09, 2002 1:21 PM
To: CF-Talk
Subject: Re: Return a Sub-Query
Yes - use the IN key word. There is no list to return - simply match
the datatypes. For example, assume that X is a varchar field and y is a
varchar field:
SELECT * FROM myTable
WHERE X IN (SELECT Y FROM myTable2)
If Y returns 1 or more records, it will match them to X.
-mk
-Original
never mind hehe... I misread your question.
-Original Message-
From: Haggerty, Mike [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 08, 2002 1:32 PM
To: CF-Talk
Subject: Return a Sub-Query as a Comma Delimited List
The subject line says it all... I am writing a query for MS SQL
You may want to look at this
http://www.sqlteam.com/item.asp?ItemID=2368
I tried this a few weeks ago. Seems that it needs to be a stored procedure
to run. I was looking for a solution that involved a simple query. But, it
may help you.
Mark W. Breneman
-Macromedia Certified ColdFusion
Mike,
Although it's not possible to return a comma delimited list of
values from a subquery in the select statement, maybe the this
block of test code will help you produce the results you're
looking for:
cfquery name=UserTasks datasource=test
select u.username, t.taskname
from users
This explains why I didn't understand how coallesce was supposed to produce
a comma delimited list...
DECLARE @EmployeeList varchar(100)
SELECT @EmployeeList = COALESCE(@EmployeeList + ',', '') +
CAST(Emp_UniqueID AS varchar(5))
FROM SalesCallsEmployees
WHERE SalCal_UniqueID = 1
SELECT
10 matches
Mail list logo