[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Hitesh Joshi

3/28/2007 5:24:00 PM

Hi,

I have a store procedure that I run using BCP to generate a report.
I cannot do osql/isql because of certain formating issue. I want to
sort the result ORDER BY DateTimeStamp ASC

here is the syntax.. If I do that then header col goes at the
bottom..

SELECT CONVERT (varchar (20), 'Account '),
CONVERT (varchar(7), 'Sym')
CONVERT (varchar(25), 'DateTimeStamp') AS
'DateTimeStamp'
UNION ALL
SELECT CONVERT (varchar(20), e.Account),
CONVERT (varchar (7), e.Sym),
CONVERT (varchar(25), e.DateTimeStamp, 21) AS
DateTimeStamp
FROM TbleReport e
ORDER BY DateTimeStamp

any hints on where I keep header col on top still able to sort
DateTimeStamp
ASC

hj

5 Answers

masri999

3/28/2007 5:40:00 PM

0

On Mar 28, 10:23 pm, "Hitesh" <hitesh...@gmail.com> wrote:
> Hi,
>
> I have a store procedure that I run using BCP to generate a report.
> I cannot do osql/isql because of certain formating issue. I want to
> sort the result ORDER BY DateTimeStamp ASC
>
> here is the syntax.. If I do that then header col goes at the
> bottom..
>
> SELECT CONVERT (varchar (20), 'Account '),
> CONVERT (varchar(7), 'Sym')
> CONVERT (varchar(25), 'DateTimeStamp') AS
> 'DateTimeStamp'
> UNION ALL
> SELECT CONVERT (varchar(20), e.Account),
> CONVERT (varchar (7), e.Sym),
> CONVERT (varchar(25), e.DateTimeStamp, 21) AS
> DateTimeStamp
> FROM TbleReport e
> ORDER BY DateTimeStamp
>
> any hints on where I keep header col on top still able to sort
> DateTimeStamp
> ASC
>
> hj

Some thing on these lines

SELECT CONVERT (varchar (20), 'Account '),
> CONVERT (varchar(7), 'Sym')
> CONVERT (varchar(25), 'DateTimeStamp') AS
> 'DateTimeStamp'
> UNION ALL
> SELECT CONVERT (varchar(20), e.Account),
> CONVERT (varchar (7), e.Sym),
> CONVERT (varchar(25), e.DateTimeStamp, 21) AS
> DateTimeStamp
> FROM TbleReport e
> ORDER BY CASE WHEN DateTimeStamp = 'DateTimeStamp' THEN '00000000' else DateTimeStamp END




Hitesh Joshi

3/28/2007 5:53:00 PM

0

On Mar 28, 1:39 pm, "M A Srinivas" <masri...@gmail.com> wrote:
> On Mar 28, 10:23 pm, "Hitesh" <hitesh...@gmail.com> wrote:
>
>
>
>
>
> > Hi,
>
> > I have a store procedure that I run using BCP to generate a report.
> > I cannot do osql/isql because of certain formating issue. I want to
> > sort the result ORDER BY DateTimeStamp ASC
>
> > here is the syntax.. If I do that then header col goes at the
> > bottom..
>
> > SELECT CONVERT (varchar (20), 'Account '),
> > CONVERT (varchar(7), 'Sym')
> > CONVERT (varchar(25), 'DateTimeStamp') AS
> > 'DateTimeStamp'
> > UNION ALL
> > SELECT CONVERT (varchar(20), e.Account),
> > CONVERT (varchar (7), e.Sym),
> > CONVERT (varchar(25), e.DateTimeStamp, 21) AS
> > DateTimeStamp
> > FROM TbleReport e
> > ORDER BY DateTimeStamp
>
> > any hints on where I keep header col on top still able to sort
> > DateTimeStamp
> > ASC
>
> > hj
>
> Some thing on these lines
>
> SELECT CONVERT (varchar (20), 'Account '),
>
>
>
> > CONVERT (varchar(7), 'Sym')
> > CONVERT (varchar(25), 'DateTimeStamp') AS
> > 'DateTimeStamp'
> > UNION ALL
> > SELECT CONVERT (varchar(20), e.Account),
> > CONVERT (varchar (7), e.Sym),
> > CONVERT (varchar(25), e.DateTimeStamp, 21) AS
> > DateTimeStamp
> > FROM TbleReport e
> > ORDER BY CASE WHEN DateTimeStamp = 'DateTimeStamp' THEN '00000000' else DateTimeStamp END- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

sorry.. what is on that line?


ML

3/28/2007 9:52:00 PM

0

Look at the ORDER BY clause:

Yours:
ORDER BY DateTimeStamp

M A Srinivas's:
ORDER BY CASE WHEN DateTimeStamp = 'DateTimeStamp' THEN '00000000' else
DateTimeStamp END

Notice the difference? ;)


ML

---
http://milambda.blo...

masri999

3/29/2007 3:21:00 AM

0

On Mar 28, 10:52 pm, "Hitesh" <hitesh...@gmail.com> wrote:
> On Mar 28, 1:39 pm, "M A Srinivas" <masri...@gmail.com> wrote:
>
>
>
>
>
> > On Mar 28, 10:23 pm, "Hitesh" <hitesh...@gmail.com> wrote:
>
> > > Hi,
>
> > > I have a store procedure that I run using BCP to generate a report.
> > > I cannot do osql/isql because of certain formating issue. I want to
> > > sort the result ORDER BY DateTimeStamp ASC
>
> > > here is the syntax.. If I do that then header col goes at the
> > > bottom..
>
> > > SELECT CONVERT (varchar (20), 'Account '),
> > > CONVERT (varchar(7), 'Sym')
> > > CONVERT (varchar(25), 'DateTimeStamp') AS
> > > 'DateTimeStamp'
> > > UNION ALL
> > > SELECT CONVERT (varchar(20), e.Account),
> > > CONVERT (varchar (7), e.Sym),
> > > CONVERT (varchar(25), e.DateTimeStamp, 21) AS
> > > DateTimeStamp
> > > FROM TbleReport e
> > > ORDER BY DateTimeStamp
>
> > > any hints on where I keep header col on top still able to sort
> > > DateTimeStamp
> > > ASC
>
> > > hj
>
> > Some thing on these lines
>
> > SELECT CONVERT (varchar (20), 'Account '),
>
> > > CONVERT (varchar(7), 'Sym')
> > > CONVERT (varchar(25), 'DateTimeStamp') AS
> > > 'DateTimeStamp'
> > > UNION ALL
> > > SELECT CONVERT (varchar(20), e.Account),
> > > CONVERT (varchar (7), e.Sym),
> > > CONVERT (varchar(25), e.DateTimeStamp, 21) AS
> > > DateTimeStamp
> > > FROM TbleReport e
> > > ORDER BY CASE WHEN DateTimeStamp = 'DateTimeStamp' THEN '00000000' else DateTimeStamp END- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
>
> sorry.. what is on that line?- Hide quoted text -
>
> - Show quoted text -

I think post got trucated (?) or network issue

declare @tbla table ( a int , b datetime)
insert into @tbla values(1,'01/01/2006')

select T.* from
(
select a, cast('header' as varchar(10)) as b from @tbla
union all
select a, convert(varchar(10),b,101) as b from @tbla
) T
order by case when T.b='header' then '0' else T.b end




howie

5/23/2009 4:30:00 PM

0

On May 22, 11:09 pm, Nutella <amongthebeliev...@yahoo.com> wrote:
> On May 21, 9:42 pm, ho...@boardermail.com wrote:
>
>
>
>
>
> > On May 20, 7:19 pm, WJM <b.muldow...@gmail.com> wrote:
>
> > > You've got 20 songs to choose for a car trip you're taking and you
> > > decide an all-Bruce CD would be a good one for a trip. Which 20 songs
> > > would you choose and (for bonus points) in what order would you
> > > sequence them?
>
> > Waiting On A Sunny Day
> > Waiting On A Sunny Day (Boston)
> > Waiting On A Sunny Day (Boston)
> > Waiting On A Sunny Day (Hartford)
> > Waiting On A Sunny Day (Austin)
> > Waiting On A Sunny Day (LA)
> > Waiting On A Sunny Day (LA)
> > Waiting On A Sunny Day (Atlanta)
> > Waiting On A Sunny Day (Toronto)
> > Waiting On A Sunny Day (Philly)
> > Waiting On A Sunny Day (Philly)
> > Waiting On A Sunny Day (Glendale)
> > Waiting On A Sunny Day (San Jose)
> > Waiting On A Sunny Day (Denver)
> > Waiting On A Sunny Day (Pitt)
> > Waiting On A Sunny Day (Giants Stadium)
> > Waiting On A Sunny Day (St Paul)
> > Waiting On A Sunny Day (Washington)
> > Waiting On A Sunny Day (Chicago)
> > Mary’s Place
>
> LOL. This has Postal's fingerprints written ALL OVER it. (I'm ok with
> Mary's Place, just as long as it's the "I'M BUILDING A HOOOUUUUSSEE!!
> version)- Hide quoted text -
>
> - Show quoted text -

While there are other songs I wouldn't mind seeing played live, I
really don't mind seeing it. Since so many people have such hatred of
the song, I couldn't resist. ps...since you are correct in saying
this is something Postal would post, I will let you get away with the
comparison this time.