Showing posts with label Useful SQL queries. Show all posts
Showing posts with label Useful SQL queries. Show all posts

Saturday, December 10, 2022

SQL query to get table name from table ID

 select NAME

     from SQLDICTIONARY

     where TABLEID = 366 and FIELDID = 0


Select * from SysTableIdView Where SystableIdView.Name = ‘PurchTable’

No Lock SQL query sample

 This sql query shows the records that are stored in SQL table buffer between the ttsbegin and ttscommit. In case, if there is failure to insert record into table. we can know what record was present before the failure

select REPLENISHMENTORDERNUMBER, * from ConsignmentDraftReplenishmentOrderJournalLine with (nolock) order by recid desc


Query to select last 10 records

  select TOP 10 itemid, QTY, INVENTTRANSORIGIN, INVENTDIMID, * from INVENTTRANS with (nolock) order by recid desc 

SQL Syntax to find enum values of extended enum

 SELECT ev.NAME,ev.ENUMVALUE

  FROM ENUMIDTABLE ei

  INNER JOIN ENUMVALUETABLE ev

    ON ev.ENUMID = ei.ID

  WHERE ei.NAME = 'ProjTransStatus'

  ORDER BY ev.ENUMVALUE


Build Explained

Useful Blogs. https://axtechsolutions.blogspot.com/2018/08/performing-builds-in-d365.html https://community.dynamics.com/blogs/post/?postid=...