Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   General IT Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=19)
-   -   SQL Query help (https://www.cableforum.uk/board/showthread.php?t=10682)

Bifta 06-04-2004 13:31

SQL Query help
 
Need a spot of help, I have a SQL database I need to insert values in to.

Basically the table has 10 columns, all with data in, but there's a column I need to populate with a set bit of text, I tried

INSERT INTO homes
(agent)
values (whatever)

but obviously this just creates a new row with nothing populated in the other columns .. so er, how do I insert a value into 'agent' for all the current rows?

Thanks.

Tricky 06-04-2004 13:41

Re: SQL Query help
 
update tablename set columnname = "value"
can add a where columnname = "value" if you want to restrict this to certain rows

Bifta 06-04-2004 13:47

Re: SQL Query help
 
Quote:

Originally Posted by Tricky
update tablename set columnname = "value"
can add a where columnname = "value" if you want to restrict this to certain rows

Genius! Thank you.

John Smiths 06-04-2004 14:40

Re: SQL Query help
 
Quote:

Originally Posted by Tricky
update tablename set columnname = "value"
can add a where columnname = "value" if you want to restrict this to certain rows

Wouldn't that change the name of the column to 'value'?? Or would it add value into every row with columname?

Bifta 06-04-2004 14:51

Re: SQL Query help
 
Quote:

Originally Posted by John Smiths
Wouldn't that change the name of the column to 'value'?? Or would it add value into every row with columname?

No, cos you stick the columnname in instead of value ;) and it worked perfectly so it must be right.

Richard M 06-04-2004 15:03

Re: SQL Query help
 
It is right. :)


All times are GMT. The time now is 01:52.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum