Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 This is a sql datatype problem

Author  Topic 

chfunglukas
Starting Member

1 Post

Posted - 2010-09-17 : 03:21:29
This is a sql datatype problem

Hello
I am a junior programmer and new member of this forum

I want to ask a question

I have these two columns in sql 2000 server

trx_date char(8)
trx_time char(6)

And now, I imported this database to sql 2008

and want to copy those two columns' record to a new column call
trx_datetime (datetime)


Please guide me , thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-09-17 : 03:23:02
example data?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-09-17 : 03:30:51
quote:
Originally posted by chfunglukas

This is a sql datatype problem

Hello
I am a junior programmer and new member of this forum

I want to ask a question

I have these two columns in sql 2000 server

trx_date char(8)
trx_time char(6)

And now, I imported this database to sql 2008

and want to copy those two columns' record to a new column call
trx_datetime (datetime)


Please guide me , thanks



Try this -

SELECT trx_date + ' ' + trx_time FROM table

I think it will work.

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-09-17 : 04:15:14
What happens if you execute the below query in SQL 2000

select convert(datetime,trx_date + '' + trx_time )from yourtable



Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-09-17 : 06:25:20
What format for date are you using when storing data as text?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-09-17 : 07:34:19
quote:
Originally posted by Peso

What format for date are you using when storing data as text?



N 56°04'39.26"
E 12°55'05.63"



That's why I asked for example data


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -