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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to convert datetime in SQL server compact edit
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

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.

Thanks In Advanced

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

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

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  
 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