473,320 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to append data with selected data plus values?

Greetings,

This is probably an easy thing to do, but I can't seem to figure it out. My main data set is a massive table with 15 columns and thousands of rows. The data entry form forces certain consistencies in the data (if column A = "bluejay", column B = "bird"). However, I've agreed to upload archived data from a previous source where these consistencies were not enforced. So, I wrote 10 or so queries looking for specific inconsistencies.

What I want to do is simple: I want to turn those 10 select queries into append queries and add them to tbl_errors; tbl_errors has one extra column called 'Error Type'. When when qry_append_1 adds its lines, I want it insert a value into tbl_error.[Error Type], something that simply tells me what query it came from (the text "qry_append_1" would be fine).

It's got to be something like:
Expand|Select|Wrap|Line Numbers
  1. "INSERT INTO tbl_errors SELECT tbl_source.* FROM tbl_source WHERE [condition 1]...;"
  2.  
"
combined with:
Expand|Select|Wrap|Line Numbers
  1. "INSERT INTO tbl_errors.[Error Type] VALUES (qry_append_1)...;"
  2.  
Do I need some sort of UNION of the two?
Feb 25 '11 #1

✓ answered by TheSmileyCoder

Im not 100% sure, but I think this should do:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tbl_errors SELECT tbl_source.*,'qry_Append_1' FROM tbl_source WHERE [condition 1]...;
Notice the single ' around the string qry_Append_1

3 1569
TheSmileyCoder
2,322 Expert Mod 2GB
Im not 100% sure, but I think this should do:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tbl_errors SELECT tbl_source.*,'qry_Append_1' FROM tbl_source WHERE [condition 1]...;
Notice the single ' around the string qry_Append_1
Feb 25 '11 #2
This is close!! I figured it out:
Expand|Select|Wrap|Line Numbers
  1. "INSESRT INTO tbl_errors ([fld1], [fld2], ..., [Error Type]) SELECT tbl_source.[fld1], tbl_source.[fld2],..., 'qry_append_1' AS [Error Type] FROM tbl_source WHERE...;"
  2.  
Feb 25 '11 #3
TheSmileyCoder
2,322 Expert Mod 2GB
Im very glad that you got it figured out.
Feb 25 '11 #4

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

Similar topics

0
by: elcc1958 | last post by:
I need to support a VB6 application that will be receiving disconnected ADODB.Recordset from out DotNet solution. Our dotnet solution deals with System.Data.DataTable. I need to populate a...
2
by: Apple | last post by:
I had create a query with one table and one query, and then create form with that query using wizard, but I can't append or edit data in that form & query. Please help!
5
by: \A_Michigan_User\ | last post by:
I'm using asp.net/vb.net/ado.net to create a very simple user interface. (Everything works if I use STATICALLY created textBoxes... but not when I make them DYNAMICALLY.) 1. Execute a SQL...
2
by: tamatem | last post by:
I made ahuge load script in SQL Server 2000 as i load data from many tables(select some of each one collumns) into one single table and i want to test the loaded data against the selected data to...
1
by: David | last post by:
Under asp.net 2, if I define SqlDatasource and bind it to a grid, is selected data accessible in code? Eg. if I select s single row from the grid, can I go to the base data from the SqlDatasource...
0
by: sravan_reddy001 | last post by:
i found the folloling error message when tried to administer the login control of the webpage:: There is a problem with your selected data store. This can be caused by an invalid server name or...
2
by: Steve Kershaw | last post by:
Hello, I'm trying to bind a DirectoryInfo array to a GridView (.DataBind();). Whenever I hit the gridDirList.DataBind(); method I get the error: A field or property with the name...
0
by: svgeorge | last post by:
I have web pages for making several 9 type of payments. The data gets loaded on web page from SQL server 2005 database. Then I have Process payment button(ProcPaymBTM_Click) on the web page(Detail...
2
by: munther | last post by:
hi there : i was created datagrid and it have three template colume, in the template colume dropdownlist the dropdownlist get data from data base . * the question i want return selected value...
2
by: sivasweety | last post by:
I have created a List of contents in a database table which will display in Datagrid window. The user may select one or many data from the Datagrid. If data selected data should be shown in...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.