Re: how to convert varchar into smalldatatime
From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 09/17/04
- Previous message: Vishal Parkar: "Re: NOT IN Query Returns No Results"
- In reply to: new: "how to convert varchar into smalldatatime"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Sep 2004 22:08:06 +0530
you can make use of CONVERT function. See following example.
ex:
create table dt_Tab (dt varchar(12))
insert into dt_tab values ('31/12/75')
insert into dt_tab values ('31/01/75')
insert into dt_tab values ('28/02/75')
--add column
alter table dt_tab add date1 smalldatetime
--update statement with CONVERT function and using syntax format "3". See
more help on CONVERT function in books online.
update dt_tab
set date1 = convert (datetime,dt,3)
-- Vishal Parkar vgparkar@yahoo.co.in | vgparkar@hotmail.com
- Previous message: Vishal Parkar: "Re: NOT IN Query Returns No Results"
- In reply to: new: "how to convert varchar into smalldatatime"
- Messages sorted by: [ date ] [ thread ]