LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

delete column in database

Hi All,

 

Ca anybody Explain me how to delete the perticular entire column  in a table.

 

 

Regards,

Srinath 

0 Kudos
Message 1 of 12
(2,917 Views)

I think you can not delete a complete coulmn from the table in the database.

either you have to create new table in the database.

 

or else you can delete values from the selected cloumn by writing delete query. (

DELETE FROM table_name
WHERE some_column=some_value)
 
 
Regards
Prabhakant Patil
0 Kudos
Message 2 of 12
(2,912 Views)

Just note for you

 

WHERE clause in the DELETE syntax. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!

 

 

 

Regards
Prabhakant Patil
0 Kudos
Message 3 of 12
(2,908 Views)

It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact

 

Use following query

 

DELETE FROM table_name

or

DELETE * FROM table_name
 
 
Regards
Prabhakant Patil
0 Kudos
Message 4 of 12
(2,907 Views)

Did you even try a google search for deleting a column with SQL? Of course not, otherwise you would not be asking the question, I guess. Why you think this is a LabVIEW question, I have no idea, though. Look up the ALTER TABLE syntax.

0 Kudos
Message 5 of 12
(2,894 Views)

Correct.

Just Check with the SQL Help

Regards
Prabhakant Patil
0 Kudos
Message 6 of 12
(2,884 Views)

Do you want to delete a column, or change the value of a field (column name) of all records to nothing (NULL).

 

If you want to clear/change to NULL then you can use an UPDATE statement, but this is not something that you 'just play around with'

 

Spoiler
UPDATE table_name SET column_name = NULL

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 7 of 12
(2,871 Views)

Example of Update statement is

 

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
 
 
Regards
Prabhakant Patil
0 Kudos
Message 8 of 12
(2,859 Views)

Hi Patil,

 

 

Can you Explainme how to rename the Column name in a table

 

Regards,

srianth

0 Kudos
Message 9 of 12
(2,853 Views)

You can use foolwing statement to rename column name

 

sp_RENAME 'TableName.[OldColumnName]' , '[NewColumnName]', 'COLUMN'

 

More in details

 

USE [Database name]

GO
sp_RENAME 'TableName.[OldColumnName]' , '[NewColumnName]', 'COLUMN'

GO

 

 

Regards
Prabhakant Patil
0 Kudos
Message 10 of 12
(2,844 Views)