473,402 Members | 2,072 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,402 software developers and data experts.

wildcards in dropping constarints

Hi,

Is it possible to use wildards in SQL to drop a constraint on a table?

Thanks!
Jul 20 '05 #1
3 3456

"sashi" <sa*********@yahoo.com> wrote in message
news:e7**************************@posting.google.c om...
Hi,

Is it possible to use wildards in SQL to drop a constraint on a table?

Thanks!


No, but if you can explain what you're trying to do, and give some examples
of table and constraint names, then perhaps someone can suggest a solution.
If you want to drop a lot of constraints, then this post might help:

http://groups.google.com/groups?hl=e...ews.bluewin.ch

Simon
Jul 20 '05 #2
Here are more details for what I am looking for:

I have a constraint on a table "Series" , and it has the following
name :
"FK__SERIES__issue_id__59C55456"

To remove the constraint, I would use a statement like :
"alter table series drop constraint FK__SERIES__issue_id__59C55456"

I want to know if there is some way to use wildcards ('%', '_' etc) to
write a statement that would achieve a similar result to that above,
but without having to give the entire key name, but by just specifying
a shorter form of the key using wildcards.
Jul 20 '05 #3
sashi (sa*********@yahoo.com) writes:
Here are more details for what I am looking for:

I have a constraint on a table "Series" , and it has the following
name :
"FK__SERIES__issue_id__59C55456"

To remove the constraint, I would use a statement like :
"alter table series drop constraint FK__SERIES__issue_id__59C55456"

I want to know if there is some way to use wildcards ('%', '_' etc) to
write a statement that would achieve a similar result to that above,
but without having to give the entire key name, but by just specifying
a shorter form of the key using wildcards.


No there isn't.

But you can say:

SELECT 'ALTER TABLE tbl DROP CONSTRAINT ' + name
FROM sysobjects
WHERE parent_obj = object_id('tbl')
AND xtype IN ('UQ', 'PK', 'F', 'D', 'C')

and then cut and paste the result.

I would also encourage you to in the future, name your constraints
explicitly, preferably with some consistent naming scheme, which
makes these dropping operations a little easier.


--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #4

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

Similar topics

6
by: Bharath Dhurjati | last post by:
Hello, I am looking for documentation that specifies the following behavior exhibited by java. The following (assuming MyClass.class is accessible and has a main()) java MyClass * yields...
1
by: Ralph Noble | last post by:
I thought this problem would go away over the Christmas holiday, but of course it did not. I'm trying to write a stored procedure incorporating wildcards, so I can search for variations. Example,...
11
by: Shyguy | last post by:
I need to import a text file pretty much daily. I download the file and change the name to a standard name and then run the code to import the file into a table in my database. The problem is...
10
by: Alvaro Puente | last post by:
Hi all! Do any of you know if wildcards are accepted when calling rename() function? Thanks/Alvaro
6
by: Andy | last post by:
I have a form with several ComboBoxes. One of these is Surname, can I make it select all the Smiths for example by using wildcards? At the moment my query only picks up the individual Surname...
2
by: Dennis | last post by:
I am trying to implement a "Find and Replace" dialog that allows using wildcards in the find string, much like the Find and Replace Dialogs in Ms Word, etc. Are there any references or examples on...
1
by: Anandan | last post by:
Hi, This is regarding Dataset Filter: WILDCARD CHARACTERS Both the * and % can be used interchangeably for wildcards in a LIKE comparison. If the string in a LIKE clause contains a * or %,...
19
by: Alan Carpenter | last post by:
Access 8 on Win98 and WinXP I'm having trouble with wildcards in the .Filename property of the FileSearch Object giving different results on win98 and XP. I've been successfully using...
5
by: nidaar | last post by:
From a security point of view, is accepting wildcards like "%" in input parameters of stored procedures against any best practices? As an example, if a user defined function uses "Productname...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
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...
0
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...
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...

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.