Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concatenate columns 1

Status
Not open for further replies.

richey1

Technical User
Oct 5, 2004
184
GB
I have two columns - Decisionday of datatype numeric and decisionmonth of dattype datetime
How can i concatenate these two columns?

so if decisionmonth says 01/01/05 and decisionday is 23 then Expr1 would be 23/01/05

thanks
ian
 
I am just passing through, so as a quickie, try:

cast(cast(decisionmonth as varchar(4)) + cast(Decisionday as varchar(2)) + substring(cast(decisionmonth as varchar(20)),7,20) as datetime)

Derren
[Mediocre talent - spread really thin]
 
One of many ways:
Code:
dateadd( dd, DecisionDay-datepart(dd, DecisionMonth), DecisionMonth )
 
Oh, that's much better

Derren
[Mediocre talent - spread really thin]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top