none
whats the meaning of up side down blue arrow in sql server RRS feed

  • Question

  • Hi members i have a question

    whats the meaning of upside down blue arrow in sql server

    and how to know all the relations from table to another in database because i work with database already created

    please help me

    • Moved by Tom Phillips Thursday, June 20, 2019 11:46 AM SSMS question
    Thursday, June 20, 2019 8:05 AM

All replies

  • What for a blue arrow / where do you see it?

    See View the Dependencies of a Table and sp_depends (Transact-SQL)


    Olaf Helper

    [ Blog] [ Xing] [ MVP]


    Thursday, June 20, 2019 8:10 AM
  • Thursday, June 20, 2019 8:20 AM
  • It looks like you use an old  SSMS version , so I cannot see it

    >>and how to know all the relations from table to another in database because i work with >>>database 

    IF OBJECT_ID('GetForeignKeyRelations','P') IS NOT NULL
    DROP PROC GetForeignKeyRelations
    GO

    CREATE PROC GetForeignKeyRelations
    @Schemaname Sysname = 'dbo'
    ,@Tablename Sysname
    ,@WhereClause NVARCHAR(2000) = ''
    ,@GenerateDeleteScripts bit  = 0 
    ,@GenerateSelectScripts bit  = 0

    AS

    SET NOCOUNT ON

    DECLARE @fkeytbl TABLE
    (
    ReferencingObjectid int NULL
    ,ReferencingSchemaname  Sysname NULL
    ,ReferencingTablename   Sysname NULL 
    ,ReferencingColumnname  Sysname NULL
    ,PrimarykeyObjectid     int  NULL
    ,PrimarykeySchemaname   Sysname NULL
    ,PrimarykeyTablename    Sysname NULL
    ,PrimarykeyColumnname   Sysname NULL
    ,Hierarchy              varchar(max) NULL
    ,level                  int NULL
    ,rnk                    varchar(max) NULL
    ,Processed bit default 0  NULL
    );



     WITH fkey (ReferencingObjectid,ReferencingSchemaname,ReferencingTablename,ReferencingColumnname
    ,PrimarykeyObjectid,PrimarykeySchemaname,PrimarykeyTablename,PrimarykeyColumnname,Hierarchy,level,rnk)
    AS
    (
    SELECT  
       soc.object_id
      ,scc.name
      ,soc.name
      ,convert(sysname,null)
      ,convert(int,null)
      ,convert(sysname,null)
      ,convert(sysname,null)
      ,convert(sysname,null)
      ,CONVERT(VARCHAR(MAX), scc.name + '.' + soc.name  ) as Hierarchy
      ,0 as level
      ,rnk=convert(varchar(max),soc.object_id)
    FROM SYS.objects soc
    JOIN sys.schemas scc
      ON soc.schema_id = scc.schema_id
       WHERE scc.name =@Schemaname
         AND soc.name =@Tablename
      UNION ALL
      SELECT   sop.object_id
      ,scp.name
      ,sop.name
      ,socp.name
      ,soc.object_id
      ,scc.name
      ,soc.name
      ,socc.name
      ,CONVERT(VARCHAR(MAX), f.Hierarchy + ' --> ' + scp.name + '.' + sop.name ) as Hierarchy
      ,f.level+1 as level
      ,rnk=f.rnk + '-' + convert(varchar(max),sop.object_id)
    FROM SYS.foreign_key_columns sfc
    JOIN Sys.Objects sop
      ON sfc.parent_object_id = sop.object_id

    JOIN SYS.columns socp
      ON socp.object_id = sop.object_id
    AND socp.column_id = sfc.parent_column_id
    JOIN sys.schemas scp
      ON sop.schema_id = scp.schema_id
    JOIN SYS.objects soc
      ON sfc.referenced_object_id = soc.object_id
    JOIN SYS.columns socc
      ON socc.object_id = soc.object_id
    AND socc.column_id = sfc.referenced_column_id
    JOIN sys.schemas scc
      ON soc.schema_id = scc.schema_id
        JOIN fkey f
      ON f.ReferencingObjectid = sfc.referenced_object_id
    WHERE ISNULL(f.PrimarykeyObjectid,0) <> f.ReferencingObjectid
      )

    INSERT INTO @fkeytbl
    (ReferencingObjectid,ReferencingSchemaname,ReferencingTablename,ReferencingColumnname
    ,PrimarykeyObjectid,PrimarykeySchemaname,PrimarykeyTablename,PrimarykeyColumnname,Hierarchy,level,rnk)
    SELECT ReferencingObjectid,ReferencingSchemaname,ReferencingTablename,ReferencingColumnname
    ,PrimarykeyObjectid,PrimarykeySchemaname,PrimarykeyTablename,PrimarykeyColumnname,Hierarchy,level,rnk
       FROM fkey

    SELECT F.Relationshiptree
    FROM
    (
    SELECT DISTINCT Replicate('------',Level) + CASE LEVEL WHEN 0 THEN '' ELSE '>' END +  ReferencingSchemaname + '.' + ReferencingTablename 'Relationshiptree'
       ,RNK
      FROM @fkeytbl
      ) F
    ORDER BY F.rnk ASC


    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance
    SQL Server Integration Services: Business Intelligence

    Thursday, June 20, 2019 8:40 AM
  • That are keys, golden = Primary key, the others are foreign keys: Primary and Foreign Key Constraints

    Olaf Helper

    [ Blog] [ Xing] [ MVP]


    Thursday, June 20, 2019 8:41 AM
  • yes i know that (primary key and foreign key)but i should have an idea what it do in that database so i can to work with it(it write that a constraint key) what meaning of that

    Thursday, June 20, 2019 8:46 AM
  • thanks for help i will get a try
    Thursday, June 20, 2019 11:09 AM
  • whats the meaning of upside down blue arrow in sql server

    There are no blue arrows in SQL Server. SQL Server is a server application and has no UI whatsoever. (Well, you can run it as a console application, in which case you may see the errorlog being printed, but that is as far as you get.)

    You are referrring to SSMS, SQL Server Management Studio, which is a separate program to help you to interact with SQL Server, but SSMS is not SSMS. (And since SQL 2016 also not shipped with SQL Server, but downloaded separately.)

    The blue arrow (which is more black-and-white in SSMS 18.1) represents a UNIQUE constraint.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Thursday, June 20, 2019 9:22 PM
  • thank you for replay

    what about in picture

    Friday, June 21, 2019 4:39 PM
  • You are running a very old version of SSMS.

    In that version of SSMS, the blue KEY icon represents a "unique constraint".

    In the current version it looks like this:

    Friday, June 21, 2019 4:47 PM
  • ok thanks

    so i need help

    i want make update query

    UPDATE [dbo].[F_DOCLIGNE]
       SET 
          DO_Piece='ABL30503'
         
     WHERE DO_Piece='ABC30503'
    GO


    and  i faced this error and i dont know how to resolve it this is the error

    Msg 82086, Niveau 11, État 1, Procédure TG_UPD_F_DOCLIGNE, Ligne 42
    L'entête de document n'existe pas !



    • Edited by Houssem12 Saturday, June 22, 2019 10:21 AM
    Saturday, June 22, 2019 10:14 AM
  • What has this to do with upside-down arrows? If you have a new question, you should start a new thread. (In a forum where the question is on-topic. This does not seem to be a tools question.)

    As for the message, the error number is >= 50000. This means that this a user-defined message. Apparently there is a trigger on this table that performs some validation. If you don't understand why you get the error, you will need to find someone who is responsible for the system who can help you. Or read the code to find out what the check is actually doing.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Saturday, June 22, 2019 6:00 PM