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 |
|
benko
Starting Member
24 Posts |
Posted - 2004-10-20 : 18:40:07
|
| Ok i have a #tempTable in which all of the columns are varchar. Im am going to be dynamically inserting data into it and some columns might be int or money, etc. Because now when i try inserting it says cannot convert money to varchar, etc. Thanks in advance.This is how i have it now:INSERT INTO #TempTable SELECT * FROM @TBLNAMENote: They both contain the same amount of columns. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-20 : 18:48:26
|
| What's your question? How to convert? Just use CONVERT.Tara |
 |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-20 : 19:10:22
|
Why not create the temp table with all of the proper columns??SELECT *INTO #TempTableFROM @TBLNAME Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-10-21 : 01:16:48
|
quote: Originally posted by benko Ok i have a #tempTable in which all of the columns are varchar. Im am going to be dynamically inserting data into it and some columns might be int or money, etc. Because now when i try inserting it says cannot convert money to varchar, etc. Thanks in advance.This is how i have it now:INSERT INTO #TempTable SELECT * FROM @TBLNAMENote: They both contain the same amount of columns.
enumerate the fields and converting them at the same time..select convert(datatype,field1),convert(datatype,field2)...--------------------keeping it simple... |
 |
|
|
|
|
|