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 2008 Forums
 Transact-SQL (2008)
 How to convert datetime in SQL server compact edit
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shinelawrence
Starting Member

India
32 Posts

Posted - 09/07/2013 :  05:01:44  Show Profile  Reply with Quote
Hi Everyone,
I used datetime conversion in SQL server compact edition, but i got error: The specified data type is not valid [ Data type (if known)= varchar]...but it's working in sqlserver 2008.. Pls tell the solution....
I used this sample query only.
SELECT CAST(GETDATE() AS varchar(10))

Thanks In Advanced

Edited by - shinelawrence on 09/07/2013 05:56:27

Cooper-5
Starting Member

United Kingdom
10 Posts

Posted - 09/09/2013 :  09:35:12  Show Profile  Reply with Quote
the only issue i can see with the cast is that it is for 10 characters, the outcome of that cast requires 11 characters.

could you try the below and see if it does what you require, as the conversion can output different formats depending on the integer you supply as the last parameter (e.g. 103,112, etc...)

select convert(varchar(11), getdate(), 103)

hope this helps

Nothing is truly idiot proof, because the world keeps producing a higher class of idiot
Go to Top of Page

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 09/11/2013 :  14:03:24  Show Profile  Reply with Quote
I don't think SQL CE supports VARCHAR. Try NVARCHAR instead.
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.05 seconds. Powered By: Snitz Forums 2000