Jump to content

Ms Sql Server Technology Discussions


9Pardhu

Recommended Posts

[quote name='9pardhu' timestamp='1353355952' post='1302824811']
i am unable to post here... PM chesta neeku Post it...
[/quote]
sure

Link to comment
Share on other sites

[quote name='karna11' timestamp='1353357925' post='1302825033']
HOW TO RETREIVE CHECK CONSTRAINTS OF CURRENT DATABASES?
alagee FOREIGN CONSTRAINTS kodaaa?
[/quote]


Go to Databases > Tables > Keys - for Keys
Go to Databases > Tables > Constraints - for Constraints

Link to comment
Share on other sites

[quote name='9pardhu' timestamp='1353358631' post='1302825070']


Go to Databases > Tables > Keys - for Keys
Go to Databases > Tables > Constraints - for Constraints
[/quote]

baa nuvvu marinuuu, nenu adigindhiii through query

Link to comment
Share on other sites

[quote name='karna11' timestamp='1353357925' post='1302825033']
HOW TO RETREIVE CHECK CONSTRAINTS OF CURRENT DATABASES?
alagee FOREIGN CONSTRAINTS kodaaa?
[/quote]
using GUI aithe pardhu cheppindi follow avvu

using SQL aithe use this

SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint,
SCHEMA_NAME(schema_id) AS SchemaName,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT'
GO
----

select Referencing_Object_name, referencing_column_Name, Referenced_Object_name, Referenced_Column_Name from
(select Referenced_Column_Name = c.name, Referenced_Object_name = o.name, f.constid from sysforeignkeys f, sysobjects o, syscolumns c
where (f.rkeyid = o.id) and c.id = o.id and c.colid = f.rkey) r,
(select referencing_column_Name = c.name, Referencing_Object_name = o.name, f.constid from sysforeignkeys f, sysobjects o, syscolumns c
where (f.fkeyid = o.id) and c.id = o.id and c.colid = f.fkey) f
where r.Referenced_Column_Name = f.referencing_column_Name
and r.constid = f.constid
order by f.Referencing_Object_name

Link to comment
Share on other sites

select
o1.name as Referencing_Object_name
, c1.name as referencing_column_Name
, o2.name as Referenced_Object_name
, c2.name as Referenced_Column_Name
, s.name as Constraint_name
from sysforeignkeys fk
inner join sysobjects o1 on fk.fkeyid = o1.id
inner join sysobjects o2 on fk.rkeyid = o2.id
inner join syscolumns c1 on c1.id = o1.id and c1.colid = fk.fkey
inner join syscolumns c2 on c2.id = o2.id and c2.colid = fk.rkey
inner join sysobjects s on fk.constid = s.id
and o2.name='tblUserDetails' — this predicate for a specific table

Link to comment
Share on other sites

[quote name='karna11' timestamp='1353359431' post='1302825159']
babu deals2buy neeku question clear ga ardham ayyindhaa, nenu adigindhi only check constraints not a all constrints
[/quote]
particular table meeda na? leka whole database meeda na?

Link to comment
Share on other sites

[quote name='deals2buy' timestamp='1353359811' post='1302825215']
particular table meeda na? leka whole database meeda na?
[/quote]
TABLE MEDHA KADHU, dATABASE LEVEL LOO, NUVVU AS IT IS GAA cd ISTHUNNAV GAA , CHARANALU ESIIII GOOGLE NUNDI

Link to comment
Share on other sites

[quote name='karna11' timestamp='1353359938' post='1302825228']
TABLE MEDHA KADHU, dATABASE LEVEL LOO
[/quote]
idi try chesi chudu

Select SysObjects.[Name] As [Contraint Name] ,Tab.[Name] as [Table Name],Col.[Name] As [Column Name]
From SysObjects Inner Join (Select [Name],[ID] From SysObjects Where XType = 'U') As Tab
On Tab.[ID] = Sysobjects.[Parent_Obj]
Inner Join sysconstraints On sysconstraints.Constid = Sysobjects.[ID]
Inner Join SysColumns Col On Col.[ColID] = sysconstraints.[ColID] And Col.[ID] = Tab.[ID]
where SysObjects.[Name] like 'CK%'
order by Tab.[Name]


neeku constraints names correct o kaado ela verify chesukuntaav mari?

Link to comment
Share on other sites

[quote name='karna11' timestamp='1353359938' post='1302825228']
TABLE MEDHA KADHU, dATABASE LEVEL LOO, NUVVU AS IT IS GAA cd ISTHUNNAV GAA , CHARANALU ESIIII GOOGLE NUNDI
[/quote]
@3$% nuvvu ethukodaniki badhakam esi ikkada adugutunnavemo anukunna sSa_j@il

btw paina cheppina code try chey...u may get ur answer

Link to comment
Share on other sites

×
×
  • Create New...