Need help MSSQL
Aku punya 1 table, A
A terdiri dari field col001 s.d col005, dimana semuanya bertype varchar
Nah sebenernya aku ingin melakukan insert ke table B dari Select di table A,
tapi ada kendala karena field yang mau diisi di table B itu float.
Untuk itu khan mesti aku convert dulu data A ke float? (CMIIW)
Tapi kok muncul :"Error converting data type varchar to float."
Kemudian aku coba select dulu datanya dari table A(field yang mau di-convert
col005):
select col001,cast(replace(ltrim(rtrim(col005)),',','') as float) from A where
isnumber(col005)=1
Tetep muncul: "Error converting data type varchar to float."
Kemudian aku trace data yang error dgn menggunakan Select Top X, dan ga ada
masalah sampai baris 165:
select TOP 165 col001,cast(replace(ltrim(rtrim(col005)),',','') as float) from
A where isnumber(col005)=1
Muncul lagi: "Error converting data type varchar to float."
Nah, kemudian aku liat col001(ID, Unique), dan ketemu klo baris 165,
col001=667, lalu aku loncat langsung:
select col001,cast(replace(ltrim(rtrim(col005)),',','') as float) from A where
isnumber(col005)=1 and col001=667
Dan ga masalah... nilai nya keluar.
Demikian juga dengan baris2 yang lain ga masalah (klo perbaris).
o iyah... col005 aku "replace" dulu karena format string angka nya "123,456.78"
-> 123456.78
Napa yah??
Ayo siapa yang bersedia bantu? :)
regards,
pardis kembaren
---------------------------------
Do you Yahoo!?
Plan great trips with Yahoo! Travel: Now over 17,000 guides!
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Ever feel sad or cry for no reason at all?
Depression. Narrated by Kate Hudson.
http://us.click.yahoo.com/Ntf6vA/esnJAA/d1hLAA/KbPolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ilkom_usu/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/