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 |
ihuda
Starting Member
2 Posts |
Posted - 2014-07-10 : 17:30:01
|
I just started using SQL. I have excel document with 20 different sheets, each sheet at least has 15 columns in it. I have to add a new column in one of the excel sheet using SQL(all database is in sql). I am using ALTER TABLE table_nameADD column_name datatypebut it comes back and gives me syntax error. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-10 : 17:35:11
|
Show us the exact command and the error.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2014-07-11 : 01:49:46
|
You can complete the task using powershell - it's useful for Excel sheet object managementJack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
ihuda
Starting Member
2 Posts |
Posted - 2014-07-11 : 15:33:53
|
I am writing the following commands:"ALTER TABLE Active Power Battery ADD Voltage Integer"and its gives me the following error:[Microsfot][ODBC SQL Server Driver][SQL Server]Incorrect syntax near'Power'and after clicking ok, it says[Microsfot][ODBC SQL Server Driver][SQL Server]Incorrect syntax near'Voltage'@ Jacky: I will do my research on powershell. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-11 : 15:42:33
|
You need to put square brackets around the table name and column name. I would seriously reconsider having spaces in object names![square brackets for object names with spaces]Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-11 : 15:46:29
|
You also need to add the data type.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|