Use Following
select CONVERT(datetime, '20101001', 112), CONVERT(datetime, '20101231', 112)
Or For Dynamic
exec ('select CONVERT(datetime, ''20101001'', 112), CONVERT(datetime, ''20101231'', 112)')
Thanks
Kuldeep
Kuldeep Bisht
Simplion Technologies
http://mssqlguide.kuldeepbisht.com