Showing posts with label datatype. Show all posts
Showing posts with label datatype. Show all posts

Monday, March 19, 2012

is it possible to change the Datatype in a excel file from the Float to varchar

Hi,

I have a excel file and i am trying to import zip codes to the database... but the some of the zip codes start with 06902 but the excel file treats them as float but i want to treat them as varchar...

How can i do it.

Regards

Karen

Try changing the column in Excel to a Text Column. To do that, select the column by clicking on the column heading, then format the cells and select text.|||

Thanks for ur answer,

I did it... But when i transfer the data to sql and the column which were converted to Text are NULL in Sql server...

so what should i do... and when i create a table it takes it RtnAddrZip as Float in excel

REgards

Karen

Monday, February 20, 2012

Is are a way to convert the SQL datetime to MFC CTime

Hi
Here is the time in SQL : 2/21/2003 12:00:00 PM (DataType :datetime)
How can i convert this into CTime .the MFC class
Help inthis regard is appreciated,
Thanks in AdvanceA datetime is not that format. It is a decimal number - that is just the way it is converted for display.

What format do you need it in to put into a CTime.|||Thanks 'nigelrivett' for replying me
Yes...I reading the date(datetime) from the Data Base as the String..I want Month,Year,Date,Hour and Minute to build the Time for my application.

i like to build the CTime as below:

CTime Ts(nYear,nMonth,nDate,nHour,nMinute,nSecond,o);

So please tell me how get the Hour,minute,Day,Year from the Data Base.

Thanks in advance,
Sirish|||try:
select getdate() as 'Original Date'
, datepart(yy,getdate()) as 'Year'
, datepart(mm,getdate()) as 'Month'
, datepart(dd,getdate()) as 'Day'
, datepart(hh,getdate()) as 'Hour'
, datepart(mi,getdate()) as 'Minute'
, datepart(ss,getdate()) as 'Second'
, datepart(ms,getdate()) as 'Millisecond'