• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

Sqlserver 2005 query syntax help

I have
+ convert(varchar(10), getdate(), 112)

which is part of a concantonated query

it yields:

20080625

for its piece

I need it to show:

062508

Thanks in advance
0
MyDanes
Asked:
MyDanes
  • 4
  • 3
1 Solution
 
chapmandewCommented:

select replace(convert(varchar(10), getdate(),10),'-','')
0
 
sbagireddiCommented:
SELECT REPLACE (CONVERT(varchar(10),getdate(),1),'/','')
0
 
MyDanesAuthor Commented:
Ok that did not work I got an error - I should have put the entire section which is:

select top 100 percent '2',right('0000000000' + cast(payment_id as varchar(10)),10) +
       right('0000000000' + replace(cast(amount as varchar(10)),'.',''),10) + '355008765102873' + convert(varchar(10), getdate(),10),'-','') as result
from CASHMGMT_PAYMENT

ONLY need to fix the getdate part so my output for the getdate portion shows:
062508

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
chapmandewCommented:
you forgot the 2nd replace:



select top 100 percent '2',right('0000000000' + cast(payment_id as varchar(10)),10) +
       right('0000000000' + replace(cast(amount as varchar(10)),'.',''),10) + '355008765102873' + replace(convert(varchar(10), getdate(),10),'-','') as result
from CASHMGMT_PAYMENT
0
 
chapmandewCommented:
huh?  why did you pick that one over mine?  your syntax was wrong in your 2nd post.
0
 
chapmandewCommented:
OK.  You just had me confused....thought I had answered something wrong.  :)
0
 
MyDanesAuthor Commented:
Thanks Chapmando and sorry for the trouble
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now