Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mcordewener
Starting Member
19 Posts |
Posted - 2005-10-10 : 08:23:04
|
| Hi,I am trying to create a new procedure:CREATE PROCEDURE [dbo].[qry_v2_convert_date] ASUPDATE b_tbl_vdat SET b_tbl_vdat.Usable_date = CONVERT(Date(Left(SCAPPTSEG-TST_FROM,10));From b_tbl_vdatGoWhat do i do wrong, the SQL Server keeps beeping on a wrong left function. |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-10-10 : 08:30:56
|
| Try this.. CONVERT(Date,(Left(SCAPPTSEG-TST_FROM,10)))Complicated things can be done by simple thinking |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-10 : 08:37:28
|
| What is the Data type of Usable_date?If it is DateTime or SmallDateTime then there is no need to convert itMadhivananFailing to plan is Planning to fail |
 |
|
|
mcordewener
Starting Member
19 Posts |
Posted - 2005-10-10 : 08:38:07
|
| Thank You,it worksCREATE PROCEDURE [dbo].[qry_v2_convert_date] ASUPDATE b_tbl_vdat SET b_tbl_vdat.Usable_date = CONVERT(smalldatetime,(Left([b_tbl_vdat].[SCAPPTSEG-TST_FROM],10)))From b_tbl_vdatGoI needed to declare the tablename and a different Datetype.Thnx |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-10 : 08:40:46
|
| I repeat what I asked youWhat is the Data type of Usable_date?If it is DateTime or SmallDateTime then there is no need to convert itMadhivananFailing to plan is Planning to fail |
 |
|
|
mcordewener
Starting Member
19 Posts |
Posted - 2005-10-10 : 08:43:22
|
The field needs to be updated from varchar to a date value, the download happens from SAP - Txt file to an SQL server import.Marcel Cordewenerquote: Originally posted by madhivanan I repeat what I asked youWhat is the Data type of Usable_date?If it is DateTime or SmallDateTime then there is no need to convert itMadhivananFailing to plan is Planning to fail
|
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-10 : 08:48:55
|
Then Convert is the only way MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|