Viewing 15 posts - 46 through 60 (of 101 total)
I should have tidied that up a bit...
select systemID, locations = substring((select ',' + Locations from #Address WHERE systemID = A1.systemID FOR XML PATH('')),2,1024)
from #Address A1
March 3, 2009 at 7:41 pm
Roger, Is this the sort of thing you are after?
create table #Address (systemID int, Locations varchar(16))
insert #Address select 1001, 'CA'
union all select 1001, 'ML'
union all select 1001, 'IL'
union...
March 3, 2009 at 7:38 pm
You need a function to split your comma separated variable into a table variable.
CREATE FUNCTION [dbo].[SplitList]
(
@List varchar(8000),
@splitter varchar(2)
)
RETURNS
@ParsedList table
(
num int identity(1,1),
item varchar(1024)
)
AS
BEGIN
SET @List = @splitter + LTRIM(RTRIM(@List)) + @splitter
INSERT...
March 1, 2009 at 8:26 pm
Hi ,
You can do this by joining to a cte. Note that you need to join on both reportName and UserID otherwise you will run into trouble...
Firstly run the...
February 26, 2009 at 6:12 pm
hi,
Here is an example you can hopefully build a script from. just change the table names and columns.
insert names2 (fname, lname) select fname, lname from names
truncate table names
You will...
February 26, 2009 at 3:50 pm
hi,
Using rollup may help. Just add with rollup
after your GROUP BY
http://msdn.microsoft.com/en-us/library/ms189305(SQL.90).aspx
Bevan
February 26, 2009 at 3:07 pm
Hmmm, I'm afraid you've exhausted my brain! Does anyone else have any solutions?
February 25, 2009 at 9:04 pm
Try adding
option (maxrecursion 1000)
to the very end
Bevan
February 25, 2009 at 8:47 pm
The trick is that you cannot have any other select statements before a CTE. So, although the code is correct, it cannot be run all together.
Run the first part...
February 25, 2009 at 8:18 pm
Hi Rog,
I had this written up and forgot to post it before going off to lunch!
Anyway, I have a working example for you. It uses a recursive CTE. ...
February 25, 2009 at 6:41 pm
I see Noel and I posted almost identical answers on the first question!
Heres one way to update the values...
--- Have a look at new and old data side by...
February 24, 2009 at 4:34 pm
Hi,
you need to use the row_number function to identify which specific rows you want returned. Change the order by clause if you want the oldest record.
create table # (SKU# varchar(10),...
February 24, 2009 at 4:04 pm
Viewing 15 posts - 46 through 60 (of 101 total)