HighTechTalks DotNet Forums  

UPDATE Statement without WHERE

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss UPDATE Statement without WHERE in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jonathan Wood
 
Posts: n/a

Default UPDATE Statement without WHERE - 12-18-2007 , 09:32 PM






I want to store some application-wide data in my database. The table that
stores this will store the different data in each field, and there will only
need to be one record.

Since there will only be one record, I haven't bothered to add a key
(primary or otherwise).

This seems to work fine but I'm trying to figure out what my SQL UPDATE
statement would look like. The first time my code runs, I guess I need to
create the single record. But, once created, I don't want to insert
additional records. But without a primary key and some sort of reference to
it, I don't know how to update the single record.

Can anyone help?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com


Reply With Quote
  #2  
Old   
Brendan G
 
Posts: n/a

Default Re: UPDATE Statement without WHERE - 12-18-2007 , 11:07 PM






UPDATE table SET field = value

"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote

Quote:
I want to store some application-wide data in my database. The table that
stores this will store the different data in each field, and there will
only need to be one record.

Since there will only be one record, I haven't bothered to add a key
(primary or otherwise).

This seems to work fine but I'm trying to figure out what my SQL UPDATE
statement would look like. The first time my code runs, I guess I need to
create the single record. But, once created, I don't want to insert
additional records. But without a primary key and some sort of reference
to it, I don't know how to update the single record.

Can anyone help?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com




Reply With Quote
  #3  
Old   
Cor Ligthert[MVP]
 
Posts: n/a

Default Re: UPDATE Statement without WHERE - 12-18-2007 , 11:25 PM



Johan,

In what way are you using AdoNet to update, as it is with the regular
DBAdapter Update, then only rows with the rowstate new, changed and deleted
will be done. The Where clause in this will be in my idea only some extra
ballast.

Cor

"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> schreef in bericht
news:OQBOrdeQIHA.2268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Quote:
I want to store some application-wide data in my database. The table that
stores this will store the different data in each field, and there will
only need to be one record.

Since there will only be one record, I haven't bothered to add a key
(primary or otherwise).

This seems to work fine but I'm trying to figure out what my SQL UPDATE
statement would look like. The first time my code runs, I guess I need to
create the single record. But, once created, I don't want to insert
additional records. But without a primary key and some sort of reference
to it, I don't know how to update the single record.

Can anyone help?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com



Reply With Quote
  #4  
Old   
Jonathan Wood
 
Posts: n/a

Default Re: UPDATE Statement without WHERE - 12-18-2007 , 11:27 PM



So no WHERE is needed? Cool, but can you tell me what this command does if
there are more than one records?

Thanks!

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Brendan G" <bgreen (AT) nospam (DOT) nospam> wrote

Quote:
UPDATE table SET field = value

"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote in message
news:OQBOrdeQIHA.2268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
I want to store some application-wide data in my database. The table that
stores this will store the different data in each field, and there will
only need to be one record.

Since there will only be one record, I haven't bothered to add a key
(primary or otherwise).

This seems to work fine but I'm trying to figure out what my SQL UPDATE
statement would look like. The first time my code runs, I guess I need to
create the single record. But, once created, I don't want to insert
additional records. But without a primary key and some sort of reference
to it, I don't know how to update the single record.

Can anyone help?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com





Reply With Quote
  #5  
Old   
Patrice
 
Posts: n/a

Default Re: UPDATE Statement without WHERE - 12-19-2007 , 04:31 AM



Simply, it will update all rows.

You could still create a primary key with a checked value (of example a byte
pk whose value must be necessarily 0) to express that you can only have a
single record in this table (even if for documentation purpose only).

--
Patrice


"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> a écrit dans le message de news:
%23ptf0dfQIHA.5988 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Quote:
So no WHERE is needed? Cool, but can you tell me what this command does if
there are more than one records?

Thanks!

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Brendan G" <bgreen (AT) nospam (DOT) nospam> wrote in message
news:eM1VpSfQIHA.4712 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
UPDATE table SET field = value

"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote in message
news:OQBOrdeQIHA.2268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
I want to store some application-wide data in my database. The table that
stores this will store the different data in each field, and there will
only need to be one record.

Since there will only be one record, I haven't bothered to add a key
(primary or otherwise).

This seems to work fine but I'm trying to figure out what my SQL UPDATE
statement would look like. The first time my code runs, I guess I need
to create the single record. But, once created, I don't want to insert
additional records. But without a primary key and some sort of reference
to it, I don't know how to update the single record.

Can anyone help?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com







Reply With Quote
  #6  
Old   
Jonathan Wood
 
Posts: n/a

Default Re: UPDATE Statement without WHERE - 12-19-2007 , 11:39 AM



Actually, having thought about it some more, updating all the rows makes
sense to me now. That should be suffice for my purposes.

Thanks!

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com


"Patrice" <http://www.chez.com/scribe/> wrote

Quote:
Simply, it will update all rows.

You could still create a primary key with a checked value (of example a
byte pk whose value must be necessarily 0) to express that you can only
have a single record in this table (even if for documentation purpose
only).

--
Patrice


"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> a écrit dans le message de news:
%23ptf0dfQIHA.5988 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
So no WHERE is needed? Cool, but can you tell me what this command does
if there are more than one records?

Thanks!

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Brendan G" <bgreen (AT) nospam (DOT) nospam> wrote in message
news:eM1VpSfQIHA.4712 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
UPDATE table SET field = value

"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote in message
news:OQBOrdeQIHA.2268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
I want to store some application-wide data in my database. The table
that stores this will store the different data in each field, and there
will only need to be one record.

Since there will only be one record, I haven't bothered to add a key
(primary or otherwise).

This seems to work fine but I'm trying to figure out what my SQL UPDATE
statement would look like. The first time my code runs, I guess I need
to create the single record. But, once created, I don't want to insert
additional records. But without a primary key and some sort of
reference to it, I don't know how to update the single record.

Can anyone help?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com








Reply With Quote
  #7  
Old   
William Vaughn
 
Posts: n/a

Default Re: UPDATE Statement without WHERE - 12-19-2007 , 01:35 PM



I might consider using Extended Properties to store this information as it's
not really relational data--not unless it's used in a JOIN with other
tables..

--
__________________________________________________ ________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
__________________________________________________ __________________________________________
"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote

Quote:
I want to store some application-wide data in my database. The table that
stores this will store the different data in each field, and there will
only need to be one record.

Since there will only be one record, I haven't bothered to add a key
(primary or otherwise).

This seems to work fine but I'm trying to figure out what my SQL UPDATE
statement would look like. The first time my code runs, I guess I need to
create the single record. But, once created, I don't want to insert
additional records. But without a primary key and some sort of reference
to it, I don't know how to update the single record.

Can anyone help?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com



Reply With Quote
  #8  
Old   
Jonathan Wood
 
Posts: n/a

Default Re: UPDATE Statement without WHERE - 12-19-2007 , 03:11 PM



It's not used in a JOIN. I don't know what Extended Properties are but it
seems to be working fine now. Perhaps I'll find out what Extended Properties
are at some point.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"William Vaughn" <billvaNoSPAM (AT) betav (DOT) com> wrote

Quote:
I might consider using Extended Properties to store this information as
it's not really relational data--not unless it's used in a JOIN with other
tables..

--
__________________________________________________ ________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
__________________________________________________ __________________________________________
"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote in message
news:OQBOrdeQIHA.2268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
I want to store some application-wide data in my database. The table that
stores this will store the different data in each field, and there will
only need to be one record.

Since there will only be one record, I haven't bothered to add a key
(primary or otherwise).

This seems to work fine but I'm trying to figure out what my SQL UPDATE
statement would look like. The first time my code runs, I guess I need to
create the single record. But, once created, I don't want to insert
additional records. But without a primary key and some sort of reference
to it, I don't know how to update the single record.

Can anyone help?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com




Reply With Quote
  #9  
Old   
William Vaughn
 
Posts: n/a

Default Re: UPDATE Statement without WHERE - 12-20-2007 , 01:06 AM



See http://msdn2.microsoft.com/en-us/library/aa496030.aspx

--
__________________________________________________ ________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
__________________________________________________ __________________________________________
"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote

Quote:
It's not used in a JOIN. I don't know what Extended Properties are but it
seems to be working fine now. Perhaps I'll find out what Extended
Properties are at some point.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"William Vaughn" <billvaNoSPAM (AT) betav (DOT) com> wrote in message
news:BC36B3E5-2690-4ED5-91D8-5A60DA355AB6 (AT) microsoft (DOT) com...
I might consider using Extended Properties to store this information as
it's not really relational data--not unless it's used in a JOIN with other
tables..

--
__________________________________________________ ________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
__________________________________________________ __________________________________________
"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote in message
news:OQBOrdeQIHA.2268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
I want to store some application-wide data in my database. The table that
stores this will store the different data in each field, and there will
only need to be one record.

Since there will only be one record, I haven't bothered to add a key
(primary or otherwise).

This seems to work fine but I'm trying to figure out what my SQL UPDATE
statement would look like. The first time my code runs, I guess I need
to create the single record. But, once created, I don't want to insert
additional records. But without a primary key and some sort of reference
to it, I don't know how to update the single record.

Can anyone help?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com





Reply With Quote
  #10  
Old   
Jonathan Wood
 
Posts: n/a

Default Re: UPDATE Statement without WHERE - 12-20-2007 , 07:41 PM



Thanks.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"William Vaughn" <billvaNoSPAM (AT) betav (DOT) com> wrote

Quote:
See http://msdn2.microsoft.com/en-us/library/aa496030.aspx

--
__________________________________________________ ________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
__________________________________________________ __________________________________________
"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote in message
news:u0P7UtnQIHA.2396 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
It's not used in a JOIN. I don't know what Extended Properties are but it
seems to be working fine now. Perhaps I'll find out what Extended
Properties are at some point.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"William Vaughn" <billvaNoSPAM (AT) betav (DOT) com> wrote in message
news:BC36B3E5-2690-4ED5-91D8-5A60DA355AB6 (AT) microsoft (DOT) com...
I might consider using Extended Properties to store this information as
it's not really relational data--not unless it's used in a JOIN with
other tables..

--
__________________________________________________ ________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
__________________________________________________ __________________________________________
"Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote in message
news:OQBOrdeQIHA.2268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
I want to store some application-wide data in my database. The table
that stores this will store the different data in each field, and there
will only need to be one record.

Since there will only be one record, I haven't bothered to add a key
(primary or otherwise).

This seems to work fine but I'm trying to figure out what my SQL UPDATE
statement would look like. The first time my code runs, I guess I need
to create the single record. But, once created, I don't want to insert
additional records. But without a primary key and some sort of
reference to it, I don't know how to update the single record.

Can anyone help?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.