Viewing 15 posts - 256 through 270 (of 434 total)
check here
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=375199#bm375889
July 19, 2007 at 8:06 am
Do a search on this site for crosstab or pivot and you should find a few postings. Jeff Moden has posted a cool set based solution several times.
July 19, 2007 at 8:04 am
quick and dirty huh?
yes although to keep your fixed length format you will want to wrap it in a convert(char(3),case...)
July 18, 2007 at 3:28 pm
couple of ways. If it is really just 2 companies then you could use a case statement
select case
when abr = 'STL' then '014'
when abr = 'DNR' then '415'
else '000'...
July 18, 2007 at 3:18 pm
Tomm,
when I ran yours it didn't work because there was no group by in the derived table and when I added a group by on the date it returned the...
July 18, 2007 at 3:11 pm
WHen you set up the transformation and clicked on the destination tab it should have popped a window that showed the fields that would be created and their lengths.
July 18, 2007 at 3:03 pm
when you set up the export did you specify the correct field lengths in the destination text file?
If you run your select statement in query analyzer is the spacing correct?
July 18, 2007 at 2:49 pm
This will pad 0's on the front of an int field where @myint is the int field and 9 is the length you want
select LEFT (RIGHT (REPLICATE('0', 9) + convert(varchar(9),@myint),...
July 18, 2007 at 2:02 pm
No you are actually selecting the converted fields
Select convert(char(9),as.fname)
convert(char(9),as.lname)
convert(char(9),as.address)
from as
where yada yada yada.
I am looking up the 0 padding which is the replicate function and I'll have it...
July 18, 2007 at 1:33 pm
to pad spaces convert to char
select
convert(char(9),fieldname)
July 18, 2007 at 1:21 pm
what do you get if you print @cmd instead of executing it?
July 18, 2007 at 12:39 pm
Is this what you need
select logmonth,logyear,count(logremote_addr) as visitors,sum(pages) as sumpages from
(select month(logdate) as logmonth, year(logdate) as logyear,logremote_addr,count(lid) as pages from log
group by
month(logdate), year(logdate) ,logremote_addr) pagespervisitor
group by logmonth,logyear
order by...
July 18, 2007 at 12:37 pm
need to see SP_GENERATE_INSERTS but it looks like you are passing the auth paramater to SP_GENERATE_INSERTS without quoting it.
July 18, 2007 at 12:13 pm
The statement he is currently using only returns data from the first table so I did the same. Noel brought up a good point about duplicates if the fields we...
July 18, 2007 at 7:49 am
Viewing 15 posts - 256 through 270 (of 434 total)