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

Home Posts Topics Members FAQ

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 3504

"sashi" <sa*********@ya hoo.com> wrote in message
news:e7******** *************** ***@posting.goo gle.com...
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__is sue_id__59C5545 6"

To remove the constraint, I would use a statement like :
"alter table series drop constraint FK__SERIES__iss ue_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*********@ya hoo.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__is sue_id__59C5545 6"

To remove the constraint, I would use a statement like :
"alter table series drop constraint FK__SERIES__iss ue_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****@sommarsk og.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
9716
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 the same result on Windows as on Unix, inspite of Windows not
1
10634
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, if name 'Smith' is submitted, sproc should retrieve all records containing 'John Smith', 'Zenia Smith', 'Smithfield & Co.' You get the idea. Using SQL Query Analyzer, the query select * from file
11
9183
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 that the file starts with a standard name but adds the date and some other stuff to the end of the file name. Is there a way I could use a wildcard like "*" so I wouldn't have to change the name? Thanks for any help
10
5124
by: Alvaro Puente | last post by:
Hi all! Do any of you know if wildcards are accepted when calling rename() function? Thanks/Alvaro
6
8328
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 selected. Perhaps I need to re-work my form, but any ideas would be welcomed. Andy
2
5116
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 this. I have tried using the Like comparision operator but about all I can do with it is replace a whole string that contains the wildcard search string. I want to do something like finding *mysea?rch in a string like "This is mysearch string...
1
6680
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 %, those characters should be escaped in brackets (). If a bracket is in the clause, the bracket characters should be escaped in brackets (for example or
19
4663
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 FileSearch in win98 to fill an array with filenames with no problems since about 1998. From the 97 Help: (The Filename Property of the FileSearch object) --------------------------
5
36652
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 LIKE @ProductName" in WHERE clause of a select statement, and a stored procedure uses the user defined function while passing @ProductName input parameter to the user defined function, is there any security risks? Is there a better way to construct...
0
9705
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
9576
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
10567
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
10074
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9138
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4291
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
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
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.