473,804 Members | 3,509 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

run simple SQL code from within a query

Guys:

An ACCESS-newbie is knocking the door ...

I am wondering whether it is possible to run a simple SQL code to add
an autonumber field from within a Make-Table query.

Right now I am doing this in two steps:

1. run the Make-Table query to create a table - tb_temp
2. write a macro with just one RunSQL action, and the SQL statement is

Alter table tb_temp ADD column ID autoincrement

It will be nice if I could do them using one step

Another related question is that the ID column is added as the last
field of the table. Is there an easy way to move it to be the first
field without doing it manully or using another make-table query?

Thanks,
Haipeng

Jun 21 '06 #1
1 1673
sh*********@gma il.com wrote in
news:11******** *************@i 40g2000cwc.goog legroups.com:
Guys:

An ACCESS-newbie is knocking the door ...

I am wondering whether it is possible to run a simple SQL code
to add an autonumber field from within a Make-Table query.

Right now I am doing this in two steps:

1. run the Make-Table query to create a table - tb_temp
2. write a macro with just one RunSQL action, and the SQL
statement is

Alter table tb_temp ADD column ID autoincrement

It will be nice if I could do them using one step

Another related question is that the ID column is added as the
last field of the table. Is there an easy way to move it to be
the first field without doing it manully or using another
make-table query?

Thanks,
Haipeng

Just do a maketable query that puts the autonumber as the first
field.

CREATE Table tb_Tmp (PKfield autoincrement constraint PKfield
primary key, Txt1 text(25), num1 long);

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jun 21 '06 #2

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

Similar topics

3
3704
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example program #include <list>
1
1620
by: PerryC | last post by:
Can someone help me accomplish the following in a MSAccess Report: 1. Check if Me.Discipline = "RN" (within the source query) 2. Then check the Me.YearOfEmployment: (again within the same source query) if <2 then Me.BaseRate = BaseRate, if between 2 and <5 then Me.BaseRate = BaseRate * 1.03 if between 5 and <10 then Me.BaseRate = BaseRate * 1.03 * 1.03 ....
4
2077
by: d.p. | last post by:
Hi all, I'm using MS Access 2003. Bare with me on this description....here's the situation: Imagine insurance, and working out premiums for different insured properties. The rates for calculating premiums are dependant on the country in which the client is in. Therefore, we have a Country table, with its list of rates, a client table and then the property table. Getting this is great, works fine, easy! Problem is, now I need to work out a...
9
3448
by: Sandy | last post by:
Hello - I need either a cheap tool or code & DB that calculates, eg. within 50-mile radius of a zip code. Anyone have any suggestions? -- Sandy
2
2079
by: Deano | last post by:
Problem is that there are lots and lots of fields in an employee record. I specify a form control as the criterion for one of those fields which is the value of the primary key for that record. The idea is to copy the current record I am viewing in the form, to another table. I want to simple execute a stored query but I get a run-time error 3061, too few parameters. Expected 1. So even though I've specified the control within the...
17
3421
by: Liam.M | last post by:
Hey guys, Forgive me if my question my be alittle silly, but I would very much appreciate and assistance that could be given! My situation is as follows: I have created a Button, and set it's "On Click" Event proceedure to Loop through my Database and find any records that fall within a Certain Date...if a record is found...it then emails me that a record
3
7265
by: Shal | last post by:
Hi all, I have a table with 300,000 records in it and I want to run an update that has a few clauses in the WHERE command and just changes one boolean value on a subset of records. What I am curious about is the query, (if it works at all) takes ages to complete. I suppose 300,000 records is alot to process and I will sometimes want to change this boolean value on up to 20,000 of those, but I have had times of over an hour and it is still...
9
1769
by: leebridgewater | last post by:
Hello Group, I'm new to SQL sever but I have managed to create a SQL based online application and I just have a question that I'm sure someone here will be able to help me with. I have a database setup and from within this database I would like to run a query to produce a simple report showing me the enquiry details along with the network the enquiry member is from.
3
1139
by: Wazza13 | last post by:
I am using Visual Studio 2005 to build a website and ajoining applications! Everything has been set up except I am getting on error which won't let me run the page... In my home.vb code within the App_Code. Within a Region I have this code: <WebMethod()> _ Public Function HOME_buildCompanyDetails_HTML(ByVal Token As String) As String Dim htmlBuild As New homeHTMLBuilder
0
9708
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
9588
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
10589
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
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
10327
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
5527
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
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.