Forum Replies Created

Viewing 15 posts - 256 through 270 (of 434 total)

  • RE: crosstab query

    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. 

  • RE: Help with formatting data

    quick and dirty huh?

    yes although to keep your fixed length format you will want to wrap it in a convert(char(3),case...)

  • RE: Help with formatting data

    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'...

  • RE: Subquery Totals

    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...

  • RE: Help with formatting data

    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.

  • RE: Help with formatting data

    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?

  • RE: Help with formatting data

    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),...

  • RE: Help with formatting data

    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...

  • RE: Help with formatting data

    to pad spaces convert to char

    select

    convert(char(9),fieldname)

     

  • RE: Bcp utility with Stored Proc

    what do you get if you print @cmd instead of executing it?

  • RE: Subquery Totals

    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...

  • RE: Bcp utility with Stored Proc

    need to see SP_GENERATE_INSERTS but it looks like you are passing the auth paramater  to SP_GENERATE_INSERTS  without quoting it.

  • RE: JOINS instead of using IN

    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...

  • RE: Split a Column

    oh yeah, then there's that.

Viewing 15 posts - 256 through 270 (of 434 total)