473,796 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

adding fields with fixed text

I have a table generated by a query, and I'd like to add two new field
columns to the end or to generate a query which has the same effect.
One field is to be called "company" and has the word "pepsi" running
down all the rows of the column. The 2nd field is to be called "person"
and has the word "A.B." running down all the rows of the columns. How
could I do this?

Thanks. Tim Donaldson

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
4 5089
Include the column names and values in the make-table query. E.g.:

SELECT "Pepsi" As Company, "A.B." As Person, ... etc. ...

--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

Tim Donaldson wrote:
I have a table generated by a query, and I'd like to add two new field
columns to the end or to generate a query which has the same effect.
One field is to be called "company" and has the word "pepsi" running
down all the rows of the column. The 2nd field is to be called "person"
and has the word "A.B." running down all the rows of the columns. How
could I do this?


Nov 13 '05 #2

MGFoster,

Thanks for the reply. I tried what you suggested, but it didn't seem to
work. It's not clear to me how this works. I have a table with already
four columns created by a query. Do I go into into design mode and do
something there, or should I pull up the SQL code and add some lines. I
tried adding some lines to the SQL code, but was coming up with an
error.

Also do I need to create field headings for the new fields first and
then add the fixed text to all the rows in a second step? Thanks for
the clarification.

Tim
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If you don't want to re-run your make-table query you can use ALTER
TABLE instructions to add the new columns. Then run UPDATE queries to
add the "Pepsi" & "A.B." E.g.:

Add the new columns (2 DDL statements - 2 separate querys)

ALTER TABLE table_name ADD COLUMN Company TEXT(10);

ALTER TABLE table_name ADD COLUMN Person TEXT(10);

Fill columns w/ new value (an UPDATE query)

UPDATE table_name
SET Company = "Pepsi", Person = "A.B."

--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQYgn1oechKq OuFEgEQI5kgCfUO RQzJNqaLGbY/NQKE4pec45rPAAo Mxs
+UFLXWuIlhbgOEx Eo7wN1OBQ
=6irL
-----END PGP SIGNATURE-----
Tim Donaldson wrote:
MGFoster,

Thanks for the reply. I tried what you suggested, but it didn't seem to
work. It's not clear to me how this works. I have a table with already
four columns created by a query. Do I go into into design mode and do
something there, or should I pull up the SQL code and add some lines. I
tried adding some lines to the SQL code, but was coming up with an
error.

Also do I need to create field headings for the new fields first and
then add the fixed text to all the rows in a second step? Thanks for
the clarification.


Nov 13 '05 #4
MGFoster,

Sorry to not be understanding this yet. Maybe, I should start at the
very beginning. Is this it?

1) Create the query which creates my table ie. a table with 4 fields.

2) Once my query works and creates the table with 4 fields, highlight
the query and go to design view.

3) from design view, go to sql code.

4) add to whatever sql code has been generated there - add the SQL codes
which you are suggesting here. These codes will a) create the new fields
with field headings b) fill in the new columns with the specified.
word/s.

Thanks.
Tim


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
341
by: choyk1 | last post by:
I intended to save properties of an object to a Hashtable. In this case, keys and values are not fixed types and I cannot use SortedList. I have no idea what order the .NET framework add items to Hashtable when Add(key, value) method is applied. Monitoring the position items are added, I cannot find if key is the standard or value. I thought basically Hashtable function acts randomly, therefore the order will be changed unexpectedly. ...
4
1781
by: paul | last post by:
Hi, Im trying to add a dataset to the app_code directory using vs2005 \ SQL2005 beta 2. When I run through the wizard I select the option to auto create new Stored Procedures (Select, update, delete, insert commands) after already specifying a very basic select command that consists of two fields. All procedures are created fine and i'm able to save the xsd file. Then I create a new gridview in which i use the xsd file object as my
5
6532
by: johnny | last post by:
hi all, I wonder if I could do the following task in PHP before searching for javascript which I prefer not to have in my code: I have a form to create new tables in a database and, since I can't know how many columns needs each table, I want to load the page with a single text field in the form and then with a button adding more fields to the form if required.
11
3441
by: mesut demir | last post by:
Hi All, When I create fields (in files) I need assign a data type like char, varchar, money etc. I have some questions about the data types when you create fields in a file. What is the difference between data type 'CHAR' and 'TEXT'? When do you use 'VAR' in your datatype word? e.g. VARCHAR ?
2
3213
by: Justin Fancy | last post by:
Hi everyone, I need some help. I'm placing text files into a created database using vb.Net. The problem is that, i need two seperate sql statements to add both files because they are in different loops. My output comes out to be as Follows: TABLE ----------------------------------------------------
6
2243
by: Barry Edmund Wright | last post by:
Hi, We are having a large cheque run printed by an outside printer. The printer asked us to give him the layout of the fields to print on a form and send it to him. As an example the form looks like this: xxxxxxxxxxxxxxxxxx dd mm yyyy xxxxxxxxxxxxxxxxxxxxxxx zzzzzzzzz.99
4
7856
by: jaz215 | last post by:
hi! how do i add a record in a database without using the datacontrol and adodc. i want to rework my code to using purely codes and not being dependent on the design on vb. so far i have. Set rs = New ADODB.Recordset Set con = New ADODB.Connection con.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=C:\Program Files\Logsheet\Logsheet.mdb;" con.Open rs.Open "SELECT * from Employee;", con,...
18
1982
omerbutt
by: omerbutt | last post by:
AJAX PROB WITH MULTIPLE RECORDS helo iam having problem in ma code will any body look out an help, i am trying t add sale record in the database and the checkthe quantity of the part slod and decrement it to the current quantity for example if tehre is a part woth part no 10023 and its quantity in show room is 20 and total quantity is 25 then if there is a sale of 2 parts then i have to add the sale and decrement the current quantity in the...
6
4638
by: Clive Backham | last post by:
I need to set up forms where some input fields are mandatory and others are optional. A common convention is to place an asterisk on the labels of the mandatory fields. Of course, I can just hard code these asterisks, but I'd have thought it would be better to use a CSS element to control how a mandatory field should be marked. For example (using a table to lay out the fields): <tr><td class=mandatory>Label 1:</td><td><input...
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10221
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
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 we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.