Azure Data Studio - View/create synonym

sroy2022 21 Reputation points
2022-12-16T17:16:16.02+00:00

Hi,

Is there a way to view/create a synonym in Azure Data Studio just like it can be done in SSMS?

Thanks
Stéphane

SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. Seeya Xi-MSFT 16,586 Reputation points
    2022-12-19T06:17:24.17+00:00

    Hi @sroy2022 ,

    Azure Data Studio and SQL Server Management Studio are two visualization tools. Although there are many similarities, they are always different. Although ADS is gradually becoming more popular. But it is not yet as powerful as SSMS in querying data. When you want to use Synonyms, it is recommended that you use SSMS in addition to T-SQL statements.
    You can start reading here, and there is a navigation bar on the left side for you to know your current location.
    Synonyms (Database Engine)

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

4 additional answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-12-16T18:31:45.55+00:00
    0 comments No comments

  2. sroy2022 21 Reputation points
    2022-12-16T18:39:55.39+00:00

    Hi,

    I know about it about this command.

    It's just that it's very annoying trying to figure out the content. I must switch to SSMS all the time. The DBs I must investigate contain hundreds of synonyms.

    I guest I'll have to create a project and then look at the synonym.

    Thanks

    0 comments No comments

  3. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2022-12-17T10:35:15.257+00:00

    If you want to view what synonyms there are, and their definitions, use the catalog view sys.synonyms.

    0 comments No comments

  4. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2022-12-17T19:55:53.507+00:00

    Here are some examples with full-text indexing that you can continue to explore on your own. Key takeaway is that you can create a full-text index on multiple columns

    The version with FULLTEXTTABLE seems the most promising to me.

       CREATE TABLE ProductsAndBrands (ix  int NOT NULL,  
                                       Brand nvarchar(40) NOT NULL,  
                                       Product nvarchar(40) NOT NULL,  
                                       CONSTRAINT pk_ProductsAndBrands PRIMARY KEY (ix)  
       )  
       go  
       INSERT ProductsAndBrands(ix, Brand, Product)  
         VALUES(1, 'Samsung', 'Galaxy S21'),  
               (2, 'Samsung', 'QN95B Neo QLED 4K'),  
               (3, 'Volvo',   'P1800'),  
               (4, 'Volvo',   'Amazon')  
       go  
       CREATE FULLTEXT CATALOG cattie AS DEFAULT  
       go  
       CREATE FULLTEXT INDEX ON ProductsAndBrands(Brand, Product) KEY INDEX pk_ProductsAndBrands  
       go  
       WHILE EXISTS (SELECT * FROM sys.fulltext_indexes WHERE has_crawl_completed = 0)  
          WAITFOR DELAY '00:00:00.100'  
       go  
       SELECT * FROM ProductsAndBrands WHERE CONTAINS(*, '"Samsung Galaxy"')  
       SELECT * FROM ProductsAndBrands WHERE CONTAINS(*, '"Amazon Volvo"')  
       SELECT * FROM ProductsAndBrands WHERE CONTAINS(*, '"Samsung P1800"' )  
         
       SELECT * FROM ProductsAndBrands WHERE FREETEXT(*, '"Samsung Galaxy"')  
       SELECT * FROM ProductsAndBrands WHERE FREETEXT(*, '"Amazon Volvo"')  
       SELECT * FROM ProductsAndBrands WHERE FREETEXT(*, '"Samsung P1800"' )  
         
         
       SELECT PAB.Ix, PAB.Brand, PAB.Product, ft.RANK  
       FROM   ProductsAndBrands PAB  
       JOIN   FREETEXTTABLE(ProductsAndBrands, *, '"Samsung Galaxy"') ft ON ft."KEY" = PAB.ix  
       ORDER BY ft.RANK DESC  
         
       SELECT PAB.Ix, PAB.Brand, PAB.Product, ft.RANK  
       FROM   ProductsAndBrands PAB  
       JOIN   FREETEXTTABLE(ProductsAndBrands, *, '"Amazon Volvo"') ft ON ft."KEY" = PAB.ix  
       ORDER BY ft.RANK DESC  
         
         
       SELECT PAB.Ix, PAB.Brand, PAB.Product, ft.RANK  
       FROM   ProductsAndBrands PAB  
       JOIN   FREETEXTTABLE(ProductsAndBrands, *, '"Samsung P1800"') ft ON ft."KEY" = PAB.ix  
       ORDER BY ft.RANK DESC  
       go  
       DROP TABLE ProductsAndBrands  
       DROP FULLTEXT CATALOG cattie  
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.