473,388 Members | 1,188 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,388 software developers and data experts.

How to drop primary key constraint from a column or table ?

How to drop primary key constraint from a column of table ?
Actually I got so many example for this, but in that we require the primary key name also.
But I dont have the primary key name.So if I execute the query like

Expand|Select|Wrap|Line Numbers
  1. select object_name (parent_obj) ObjectName, name from sysobjects where xtype = ‘PK’ and parent_obj = (object_id(‘Admin.Technologies’))
its giving error as 'sysobject not found'
So I think access have sysobject with different name.
So please any body can help me in this scenario.
Sep 15 '10 #1
6 3147
NeoPa
32,556 Expert Mod 16PB
I suspect you would have noticed the problem yourself had you posted the code properly in the tags. The quotes are not proper quotes. They are special characters sometimes used in word processors. SQL only recognises proper quotes (').

This often occurs when working in SQL in an editor that is really a word processor, so it is worth remembering only ever to use text editors (which have no automatic replacements in the setup).
Sep 15 '10 #2
Thanks for your reply...
But after correcting the tags etc as below

Expand|Select|Wrap|Line Numbers
  1. select object_name(parent_obj), name from sysobjects where xtype='PK'
I am getting the error message like:
"The Microsoft Jet database engine cannot find the input table or query <name>. Make sure it exists and that its name is spelled correctly. (Error 3078)"
Sep 16 '10 #3
I also tried like

Expand|Select|Wrap|Line Numbers
  1. select object_name(parent_obj), name from MSysObjects where xtype ='PK' and parent_obj=(object_id('Admin.Technologies'))
but throwing error like
"Undefined function <name> in expression. (Error 3085)"
Sep 16 '10 #4
Actually my intention is to drop Primary Key from a field,but the Primary Key constraint name is unknown to me.
And whereever I got the script for that its uses Primary Key name with the query in VBA.

so I need help in this scenario.
Sep 16 '10 #5
TheSmileyCoder
2,322 Expert Mod 2GB
This is a bit of a longshot, as I've never worked directly with the system tables. However name is a reserved word as far as I know, and if you want to use it in a query, I think you need to enclose it in brackets like this:
Expand|Select|Wrap|Line Numbers
  1. select object_name(parent_obj), [name] from MSysObjects where xtype ='PK' and parent_obj=(object_id('Admin.Technologies'))
Sep 16 '10 #6
NeoPa
32,556 Expert Mod 16PB
I'm not sure how you can have access to the SQL Server yet not know the name of a particular PK. What version of the software is the server and what tool are you using to access it?

PS. Please notice again that I've had to add code tags to your posts. I mentioned this before and you seem to understand (from your response) yet you're still not following the instruction. It's probably better if you do if you plan to keep using the site and you want your account to continue working.
Sep 16 '10 #7

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

Similar topics

1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
0
by: james | last post by:
Hi guys! I´ve got a centerd table on my site with a black 1 pixel border. What i would like to do is to add a drop shadow to the table. Anyone know if it's possible to create a drop shadow for a...
11
by: Peter Foti | last post by:
Hi all, I have a form that contains a 2 column table. In the left column is the description for a particular input (ie - "First Name", "Last Name", "Phone Number", etc.). In the right column...
8
by: delete table with Visual Basic 6 | last post by:
Dear developer, I have an error message when I try to delete or drop Microsoft Access XP table with ADOX in Visual Basic 6. I use the ADOX.Catalog and ADOX.table to create and delete or drop table...
11
by: Martin | last post by:
Hi, I understand you must first remove the constraint. The following bit does not work (where t is a DataTable). It gives a 'reference not set to an object' error ...
3
by: travlintom | last post by:
Hi all. I have a datagrid that has several columns including the Primary Key as the first column. When I add records to the grid the Primary Key column show "Null". This would not be a...
2
by: Hymer | last post by:
Hello, I have a small two-column table with three rows. The first column has a logo and the second column has the name of the organization. The logo's in the first column are too high. That...
5
by: Hymer | last post by:
Hello, I have a small two-column table with three rows. The first column has a logo and the second column has the name of the organization. The logo's in the first column are too high. That...
1
by: sureshv | last post by:
I want to drop primary key from table how is it possible?
0
by: Sebastijan | last post by:
Hi I am interested in DbConnection.GetSchema method of ODP.NET oracle library. When I call (to get primary keys metadata) DataTable pkeys = DbConnection.GetSchema("PrimaryKeys"... foreach...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.