Questions tagged [alter]

'alter' is a SQL keyword used to change or modify the table structure or the records in a table.

835 questions
-1
votes
2 answers

Converting numeric date column into date and time in SQL

I'm currently using SQL Server Management Studio 2008 and the database was created a long time ago. The person that created it made Date into a numeric value and also GMT Time meaning that it is 4 hours ahead of the actual time, thus forcing a -4…
omar K
  • 225
  • 2
  • 7
  • 19
-1
votes
1 answer

date syntax issue in sql

I keep getting this error message when trying to change the data type of my column: alter table x modify column order_date date NOT NULL; ERROR at line 1 ORA-00905 missing keyword I not sure where I am going wrong, as I am aware there are many…
-2
votes
2 answers

Trying to add a Date column to table, but getting MSG 156 Incorrect syntax near the keyword error

I'm attempting to create a column which calculates the date based on the start date and a week count column. Below is my code: ALTER TABLE Salesforce_Expanded ADD current_date DATE; GO UPDATE Salesforce_Expanded SET current_date = DATEADD(week,…
-2
votes
1 answer

How to get month name from date in SQL Server

I have added a column name month_added, I run the query to extract the month from the date_added column in my table but I get an error: ERROR: column "date_added" does not exist LINE 1: SELECT date_added, DATENAME (MONTH, date_added) ^ SQL state:…
jr20
  • 11
  • 2
-2
votes
1 answer

Why do we use UNION to join rows in SQL?

Why use union in Sql at all when there must be same order of columns and it's names in the select statements. Couldn't we just update or alter the table to add more rows ?
Juggle
  • 1
  • 3
-2
votes
2 answers

How can I alter a variable within a struct (swift)?

I have the following code: struct Quiz { var gender = "she" var quizQuestions = ["Is \(gender) nice?", "Is \(gender) great?", "Is \(gender) wonderful?"] } But I get the following error message: Cannot use instance member…
Jake Jake
  • 9
  • 4
-2
votes
1 answer

Is it possible to rename a table with the actual timestamp in the tablename within a query

select (now(); just like so.. but it doesn't works: ALTER TABLE old_name RENAME TO new_name || select now();
Tibor
  • 159
  • 6
-2
votes
2 answers

Adding a column to table. Getting SYNTAX error but not sure why

Not sure why these two lines aren't letting me add a column. ALTER TABLE people ADD COLUMN job_desc VARCHAR(15) BEFORE salary;
Masiur1995
  • 15
  • 3
-2
votes
1 answer

How to recreate table in MYSQL?

I am sorry for my bad English. Okay? my problem is i need to recreate temporary table many times (more then 5). I need totally change structure of table. I try do it like this but i have errors CREATE TABLE #DeletedData (RoleName varchar(max), …
-2
votes
2 answers

add new column if the previous one is not null

I need to create sqlite statement that checks if a specific column value is not null then add a new column and insert the new value. What I already have is this : CREATE TABLE "StuPayment" ( "PayNumber" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT…
-2
votes
1 answer

Can't alter table field from float to decimal in mysql-workbench

I have created a table with a FLOAT type column. However, I found that when I query the column's MAX, MIN, AVG values I get inaccurate numbers, where the returned value is larger than what is actually stored in the table. For example, this is the…
user9371654
  • 2,160
  • 16
  • 45
  • 78
-2
votes
2 answers

Php - alter table column after insert

is it possible adding a column into a database table after an insert? If yes kindly give me an example code for it i don't know how to make of it
pao Kiff
  • 27
  • 1
  • 3
-2
votes
1 answer

mysql alter to table

I drop the mysql alter code below to database via phpmyadmin one by one, it it work fine, is there anyone could help me how to drop it all together at once? Or do you know the the samples of PHP code that may execute it? Just let me know…
user485783
  • 1,685
  • 3
  • 11
  • 12
-2
votes
1 answer

Alter command along with Default key

I wanted to add Default to an existing column through alter command , alter table Student_Details modify column Student_Class enum('First','Second','Third') Default '{1}' ; Is there any way to do it.
VijayIndia
  • 91
  • 1
  • 7
-2
votes
2 answers

missing keyword error while dropping a column

When i try to drop a column using the below command, alter table drop ; am getting "missing keyword" error. Getting the same error when am using column keyword also as below, alter table drop column…
Ramanathan K
  • 1,829
  • 3
  • 13
  • 8
1 2 3
55
56