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 |
|
Harold01
Starting Member
1 Post |
Posted - 2007-12-20 : 12:45:41
|
| I am trying to populate two fields in my table with the first 6 characters in an existing field with the following command:SELECT dimension_elist, SUBSTRING(dimension_elist FROM 1 FOR 6) AS BU_Number SUBSTRING(dimension_jde_pl FROM 1 FOR 6) AS Acct_NumberFROM JDE_ImportThe result is an error:Server: Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'FROM'.I am fairly new to SQL so I am probably missing something basic.Does anyone have any thoughts? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2007-12-20 : 12:48:08
|
| You can use LEFT(dimension_elist,6) & LEFT(dimension_jde_pl,6)OR SUBSTRING(dimension_elist,1,6) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-21 : 01:28:12
|
quote: Originally posted by Harold01 I am trying to populate two fields in my table with the first 6 characters in an existing field with the following command:SELECT dimension_elist, SUBSTRING(dimension_elist FROM 1 FOR 6) AS BU_Number SUBSTRING(dimension_jde_pl FROM 1 FOR 6) AS Acct_NumberFROM JDE_ImportThe result is an error:Server: Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'FROM'.I am fairly new to SQL so I am probably missing something basic.Does anyone have any thoughts?
Did you know SQL Server has help file where you can find some examples?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|