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

Home Posts Topics Members FAQ

sql if conditons

2 New Member
can any one explain what below code means

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_ht_litigation_ht_mast]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[ht_litigation] DROP CONSTRAINT FK_ht_litigation_ht_mast
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_ht_mutation_Ht_mast]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[ht_mutation] DROP CONSTRAINT FK_ht_mutation_Ht_mast
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Ht_tran_Ht_mast]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Ht_tran] DROP CONSTRAINT FK_Ht_tran_Ht_mast
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Ht_mast]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Ht_mast]
GO
Nov 9 '11 #1
1 1352
Rabbit
12,516 Recognized Expert Moderator MVP
If there is a foreign key constraint on those first 3 tables, it drops the constraint. If the last table is a user table, it drops the table.
Nov 9 '11 #2

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

Similar topics

4
1537
by: sf | last post by:
Would someome like to post their email filters code. Its so common that probably some standard library supports it or many would have written it already. If I have basic structure, I can take from...
1
1079
by: SG | last post by:
Hi, Is there ever a case where a total rebuilt is preferable to an update? I am talking in the context of a data warehouse. Many thanks Sam
7
1737
by: LineVoltageHalogen | last post by:
Greetings All, I was hoping that someone might be able to help me with the following issue: table ddl: create table exchange ( exchangefrom varchar(6), exchangeto varchar(6),...
26
3220
by: Peter Mount | last post by:
Hello What's the syntax for using fgets() to store a string in memory? I understand that fgets() can solve the problem of storing a string that has more characters than the size of the declared...
0
1016
by: lakshmi | last post by:
Hi all I posted a related question a couple days back. I did get a few helpful replies. However, I've not yet figured out the solution. I've read that passing HRESULTs back from .NET to COM is...
6
53306
by: Saradhi | last post by:
I want to check for a conditon as follows: if ( name Like "sa*") So, I need to use this * as a wild card and the above statement should return all those names which starts with sa. I know...
21
2652
by: Karl O. Pinc | last post by:
FYI, It'd be nice if the error message from a REFERENCES constraint mentioned the column name into which the bad data was attempted to be inserted. In PostgreSQL 7.3: sandbox=> insert into...
29
3530
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
7
1404
by: Paulo Roberto | last post by:
Hi everybody, how r u? I hope fine... People, I have a Javascript function wich returns true ou false, how do I assign the result on ASP variable? <% blnResult = Javascript:function() %> ...
5
1560
by: Garry Jones | last post by:
I want to trigger an alert if three conditons are met. How do I nest if statements? I tried this, but it triggered the alert if just one of the three conditions was met. function checkform (...
0
6904
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
7034
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
7076
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
6886
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
4472
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
2990
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...
0
1294
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 ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
174
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...

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.