473,473 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to select primary key

254 Contributor
hi

I want to select primary key field from my table.

code which I tried SELECT FLIGHT_NO FROM FLIGHT. here FLIGHT_NO is primary key. but I am getting error : Invalid Column Name

but this code works fine in Access and MySql.

so what will be the right query ?
Oct 23 '08 #1
4 3759
code green
1,726 Recognized Expert Top Contributor
I use all three database types you mention and am aware of some pitfalls.
Nothing is obviously wrong.
Do you have backticks or brackets around the field name or table name?
Can we see the exact query used in the three DBs.
Do you have such a field in the MsSql table?
Oct 23 '08 #2
ck9663
2,878 Recognized Expert Specialist
Are you trying to find the value of the column? Or are you trying to find out what is the PRIMARY KEY of the table?

If it's the former a simple

select ColumnName from YourTable.

if it's the latter,

sp_help YourTable

will show the PRIMARY KEY constraint...usually at the end.

-- CK
Oct 24 '08 #3
mukeshrasm
254 Contributor
Are you trying to find the value of the column? Or are you trying to find out what is the PRIMARY KEY of the table?

If it's the former a simple

select ColumnName from YourTable.

if it's the latter,

sp_help YourTable

will show the PRIMARY KEY constraint...usually at the end.

-- CK
Hi

problem was resolved. actually i was putting bracket in the field name
which was unnecessary.

thanks !
Oct 24 '08 #4
code green
1,726 Recognized Expert Top Contributor
Ah! The square brackets used by Access.
Access and SQL server queries are not cross platform.
In fact Access seems to be more similar to MySql
Oct 24 '08 #5

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

Similar topics

0
by: Will Potter | last post by:
I just inherited support of this app so bear with me. The scenario: Oracle 9i replicated databases, same C++ server process runs on both boxes. On a 15 minute schedule, the server that is primary...
0
by: rg | last post by:
Hello, I use invisionboard on a bid web site (20 000 visitors each day) But my server has high load average. Could you help me to optimize these select command. 1) SELECT p.*,...
0
by: Anthony Altieri | last post by:
Here is the table in question. Number of records 5512825 not a big table and plenty of good indexs i think? that is the big questions. Could some one help? After the table creation and index you...
6
by: Patrick | last post by:
Hello I have many different tables, that most have the same structure.. they all have some primary key, some fields and mylinkid ... so what I want to make is to create a stored procedure, where...
0
by: Susan Bricker | last post by:
The following error: "The current field must match the join key '?' in the table that seves as t the 'one' side of one-to-many relationship. Enter a record in the 'one' side table with the...
1
by: Grant McLean | last post by:
Hi First a simple question ... I have a table "access_log" that has foreign keys "app_id" and "app_user_id" that reference the "application_type" and "app_user" tables. When I insert into...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
3
by: stefaan.lhermitte | last post by:
Dear MySQL-ians, I perform a SELECT on my database, but it takes over a minute for every run. I have to run it over 10000 times (with different values in the WHERE), so it takes way too long. A...
6
by: jazpar | last post by:
Could anyone help med with a select statement with a join between to tables. It is to be used in a OLAP cube. I Havde table LedgerBudget and Table Admin. In table admin I can setup a from and to...
7
by: Brian | last post by:
I'm trying to run a select max() on a primary key/unique/non-identity column then + 1, all while running an insert into.. select statement. For some reason, the select max isn't quite doing the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
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.