How can I modify the size of column in a MySQL table?
I have created a table and accidentally put varchar length as 300 instead of 65353. How can I fix that? An example would be appreciated. 2 Answers 2
I have created a table and accidentally put varchar length as 300 instead of 65353. How can I fix that? An example would be appreciated. 2 Answers 2
I would need to rename a few columns in some tables in a SQLite database. I know that a similar question has been asked on stackoverflow previously, but it was for SQL in general, and the case of SQLite was not mentioned. From the SQLite documentation for ALTER TABLE, I gather that it’s not possible … Read more
How to change the column size of the salary column in the employee table from numeric(18,0) to numeric(22,5) 10 Answers 10
I am trying to change a column from a varchar(50) to a nvarchar(200). What is the SQL command to alter this table? 10 Answers 10
The SQL query that I have used is : ALTER TABLE oldtable RENAME TO newtable; But, it gives me an error. Server: Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword ‘TO’. 7 Answers 7
How do I rename a column in table xyz? The columns are: Manufacurerid, name, status, AI, PK, int I want to rename to manufacturerid I tried using PHPMyAdmin panel, but I get this error: MySQL said: Documentation #1025 – Error on rename of ‘.\shopping\#sql-c98_26’ to ‘.\shopping\tblmanufacturer’ (errno: 150) 9 Answers 9
I need to add multiple columns to a table but position the columns after a column called lastname. I have tried this: ALTER TABLE `users` ADD COLUMN ( `count` smallint(6) NOT NULL, `log` varchar(12) NOT NULL, `status` int(10) unsigned NOT NULL ) AFTER `lastname`; I get this error: You have an error in your SQL … Read more
Given the table created using: CREATE TABLE tbl_Country ( CountryId INT NOT NULL AUTO_INCREMENT, IsDeleted bit, PRIMARY KEY (CountryId) ) How can I delete the column IsDeleted? 9 s 9 ALTER TABLE tbl_Country DROP COLUMN IsDeleted; Here’s a working example. Note that the COLUMN keyword is optional, as MySQL will accept just DROP IsDeleted. Also, … Read more
I need to change the primary key of a table to an identity column, and there’s already a number of rows in table. I’ve got a script to clean up the IDs to ensure they’re sequential starting at 1, works fine on my test database. What’s the SQL command to alter the column to have … Read more
I am using the following code to check if the temporary table exists and drop the table if it exists before creating again. It works fine as long as I don’t change the columns. If I add a column later, it will give an error saying “invalid column”. Please let me know what I am … Read more