SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Dates
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Pete_N
Posting Yak Master

165 Posts

Posted - 03/06/2013 :  06:09:53  Show Profile  Reply with Quote
I have two tables both with smalldatetime fields

Select MyTime from Table1.dbo.Test returns '2010-01-28'
Select MyTime from Table2.dbo.Test returns '2010-28-01'

what is the query to return Table1,dbo.test back as 2010-28-01 and I need to do date comparasions between data in the two tables

MIK_2008
Flowing Fount of Yak Knowledge

Pakistan
1052 Posts

Posted - 03/06/2013 :  06:39:11  Show Profile  Reply with Quote
table1.dbo.test, Is table1 is Schema? If no - its a table, then how come it executed?

when both tables are having "smalldatetime" fields then how those columns hvae returned the date in two different formats? Not possible in my openion with SQL server. SQL server dates data type stores data in the format of YYYY-MM-DD

Cheers
MIK

Edited by - MIK_2008 on 03/06/2013 06:39:41
Go to Top of Page

Pete_N
Posting Yak Master

165 Posts

Posted - 03/06/2013 :  07:13:24  Show Profile  Reply with Quote
Hi,

I have sorted it. one of the tables was loaded by importing a XML file. The text date was applied to a function but when converting into the table I was using
CONVERT( SMALLDATETIME, (SELECT SQLProcesses.dbo.func_ProcessingDate_To_ClearedFundsDate(g.c.value('(@uhl1ProcessingDate)','varchar(32) ' ))), 103),

instead of

CONVERT( SMALLDATETIME, (SELECT SQLProcesses.dbo.func_ProcessingDate_To_ClearedFundsDate(g.c.value('(@uhl1ProcessingDate)','varchar(32) ' ))), 120),

It's always helps to bounce some problems off people , it focuses the mind and thing become clearer


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 03/06/2013 :  11:43:04  Show Profile  Reply with Quote
whatever you're telling doesnt make any sense
120 gives yyyy-mm-dd
which will be 2010-01-28
and 103 will give it in dd/mm/yyyy format

ie 28/01/2010

2010-28-01 is not a valid date format in SQL server



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000