|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Thank you in advance, I am having trouble with renaming tables. I've tried every syntax I can get my hands on. Here is the code, is the statement wrong?
if form_in_new_name <> 0 then sSQL = "ALTER TABLE " & form_in_name & "_table RENAME TO " & form_in_new_name & "_table ;" Set rs2 = cn.Execute(sSQL) Set rs2 = Nothing end if My second question is, is there a way through an SQL statement to change a field type, either from one type to another, or simply the size such as, varchar(50) to varchar(100). If so what would the statement(s) be? Muchas Gracias!!!!!!!! |
|
#2
|
||||
|
||||
|
To rename that table try this
Code:
sql = "ALERT TABLE '" & form_in_name & "'_table RENAME TO '" & form_in_new_name & "'_table" To change the datatype try this Code:
sql = "ALTER TABLE <tableName> ALTER COLUMN <columnName> SET DATA TYPE VARCHAR(100)" |
|
#3
|
|||
|
|||
|
Microsoft OLE DB Provider for SQL Server error '80040e14'
Incorrect syntax near the keyword 'TO'. /edit_category.asp, line 38 When I don't tell it to run the line, I can output the statement. This is exactly what statement is giving the error: ALTER TABLE Computer_Displays_table RENAME TO Computer_Display_table ; |
|
#4
|
||||
|
||||
|
try modifying it to this
Code:
sql = "ALERT TABLE ['" & form_in_name & "'_table] RENAME TO ['" & form_in_new_name & "'_table]" |
|
#5
|
|||
|
|||
|
ALTER TABLE [Computer_Displays_table] RENAME TO [Computer_Display_table] ;
Microsoft OLE DB Provider for SQL Server error '80040e14' Incorrect syntax near the keyword 'TO'. /edit_category.asp, line 38 |
|
#6
|
||||
|
||||
|
okay, try this
Code:
sql = "ALERT TABLE [" & form_in_name & "_table] RENAME TO [" & form_in_new_name & "_table]" |
|
#7
|
|||
|
|||
|
I have actually been trying without the single quotes.. the single quotes throws an error beyond the one i was already getting. I knew the single quotes was wrong to begin with and thus have been ignoring them... hence this last suggestion I have already tried and get the same error.
-Jason |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > RENAME TABLE, Change Field type varchar(50) to varchar(100) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|