Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
this query excecuting in sql but not excecuting in asp.net
SQL
"SELECT DISTINCT tbl_PT_ModelPrize.DATE, CONVERT(CHAR(4), tbl_PT_ModelPrize.DATE, 100) + CONVERT(CHAR(4), tbl_PT_ModelPrize.DATE, 120) AS date"
                                  +"FROM tbl_PT_ModelPrize INNER JOIN tbl_PT_ModelMaster ON tbl_PT_ModelPrize.MODEL_NAME = tbl_PT_ModelMaster.MODEL_NAME where"+
"  tbl_PT_ModelPrize.MODEL_NAME = tbl_PT_ModelMaster.MODEL_NAME";



the problem is conversion failed in string to smalldatetime
Posted
Updated 10-Mar-13 20:51pm
v2

Try
SQL
CAST(ModelPrize As SmallDateTime)
.
 
Share this answer
 
v2
Hi,

Use CAST or CONVERT Statements, Check the following links

CAST and CONVERT (Transact-SQL)[^]
TSQL Cast Vs Convert[^]
CAST and CONVERT (T-SQL)[^]

Regards,
GVprabu
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900