473,513 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

when should I use "insert" in SQL?

jhardman
3,406 Recognized Expert Specialist
I know this question deals with a lot of SQL, but I am applying it to ASP, so I think this is the best place for it.

When I learned SQL, I saw the "insert" command as very useless. It tries to do so much that it often gives errors, since any part of it wrong generates an error. I always use "addnew" which allows you to add each entry on a new line. Although this may generate errors, you can easily handle the errors or use the error to troubleshoot. If youhandle the error well, you can still perform the "update", essentially posting most of the data, just missing the part that gives you errors. Does this make sense?

On this forum I have seen "insert" used by default in the majority of cases and many poor newbies pulling their hair out trying to figure out were the error is. I even saw one who was trying to use "insert" to change a single field in an existing record. It doesn't make sense to me to use "insert" in this way, but maybe I am missing something. Please explain to me, when would you use "insert" rather than "addNew" or any of the other SQL key words?

Jared
Mar 22 '07 #1
1 1367
sani723
117 New Member
The AddNew method creates a new record for an updateable Recordset object.
After you call this method, the new record will be the current record.

while

The INSERT INTO statement is used to insert new rows into a table.
Mar 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5615
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
2
4678
by: EricRobineau | last post by:
hello I have a DB with many inter-related tables (MySQL) My main table called "content" has almost only foreign keys (integers) some have a 3 level relation (ex: content->city->region->country) ...
5
3075
by: Chad Richardson | last post by:
Is there a way in SQL Server 2000 to extract data from a table, such that the result is a text file in the format of "Insert Into..." statements, i.e. if the table has 5 rows, the result would be 5...
4
2058
by: hao | last post by:
Hi, all When I use ASP to insert an record to a database, I got some errors and can not insert any value with Chinese Char. The only way I can do that is use "rst1.Addnew...rst1.update". Anyone...
6
1926
by: Rich | last post by:
Hello, I have to create a table in an Access mdb (remotely) on the fly. Create Table tbl1(fld1 Integer, fld2 varchar(10), fld3...) Then I have to insert data: Insert Into tbl1 Values(" &...
20
18313
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've...
1
3978
by: oanhhuynh | last post by:
Hi, I'm designing 1 form include 2 Unbound Object Frame to insert image and memo that describe the product. On database in Access have 2 fields image and description with OLE Object property ...
3
1681
by: Twanne | last post by:
Hi, I've got a table called Aerosol and a table called LinkTabel. Now I do an update to a table from an excell sheet, this table is called ExportAerosol. So far so good, the import works...
2
5954
by: sudhakaranr | last post by:
Hi Guys.... My input is something like this "c1cc(c(cc1)I)/C=N\n1c(nnc1)S". You can see the "\n" in between the input. It is not a newline character as my input has that...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7158
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.