Must Avoid

  • In Auto Complete – Must Append ID (Primary Key) at the end of auto complete text

If Primary key is not added in auto complete text, then it will result in wrong item get selected

Will Result in performance Issue

  • When your query return single row it is better to use QueryRow instead of query all

stagging and development url

development links to the development folder of dev01 i.e. c:\anisiis\test.cartzlink.com\httpdocs
stagging links to the folder committed from development folder

You need to add .stagging. or .development. between the url like this

some examples:
original url: crm.cartzlink.com
stagging url: crm.stagging.cartzlink.com
development url: crm.development.cartzlink.com

original url: absolute.itserver.biz
stagging url: absolute.stagging.itserver.biz
development url: absolute.development.itserver.biz

original url: denim600.primeerp.top
stagging url: denim600.stagging.primeerp.top
development url: denim600.development.primeerp.top

Query Common Problems

select top 20 ISNULL(CLSG.CLSG,0) [InStock]
,products_id
,products_model
,qr_code [unit_upc]
,productDescription
,Items_ItemRetailPrice products_price
,products_status
,products_tax_class_id
,MarginA items_itemdefaultper
,BrandId
,TP
,products_typeId
,CaseCost
,Items_ItemRetailPrice
,C.category [category]
,products.deptId [DeptId]
,D.flag [Department]
,products.BrandId [BrandId]
,B.flag [BRAND]
,l.flag [Location]
,products.supplierId [vendorId]
,V.customers_firstname [vendor]
from

(
SELECT * FROM
products
WHERE productDescription like ‘%coca%’ or products_model like ‘%coca%’ or qr_code like ‘%coca%’ or CAST(products_id AS varchar) = ‘coca’
) AS products

left JOIN m_flag [l] ON l.id = products.statusId
left JOIN category [C] ON C.category_id = products.CategoryId
left JOIN customers [V] ON V.customers_id = products.supplierId
left JOIN m_flag [D] ON D.id = products.deptId
left JOIN m_flag [B] ON B.id = products.BrandId
–LEFT JOIN (SELECT productId,SUM(CLSG) CLSG FROM dbo.SR_STK_BREAKUP(GETDATE(), GETDATE(),0, 0, 0, 0, 0, 0, 0, NULL, dbo.OPG_DT_FG(GETDATE()), GETDATE(), N’D’, N’Product’, N’Product’)
GROUP BY productId)AS CLSG ON CLSG.productId= products.products_id where productDescription like ‘%coca%’ or products_model like ‘%coca%’ or qr_code like ‘%coca%’ or CAST(products_id AS varchar) = ‘coca’

CORRECT QUERY

— CLSG = OPG of next day
DECLARE @clsgDate AS DATETIME = DATEADD(d,1,GETDATE());
DECLARE @opgDtFgResult AS DATETIME = dbo.OPG_DT_FG(@clsgDate);

select top 20 ISNULL(CLSG.CLSG,0) [InStock]
,products_id
,products_model
,qr_code [unit_upc]
,productDescription
,Items_ItemRetailPrice products_price
,products_status
,products_tax_class_id
,MarginA items_itemdefaultper
,BrandId
,TP
,products_typeId
,CaseCost
,Items_ItemRetailPrice
,C.category [category]
,products.deptId [DeptId]
,D.flag [Department]
,products.BrandId [BrandId]
,B.flag [BRAND]
,l.flag [Location]
,products.supplierId [vendorId]
,V.customers_firstname [vendor]
FROM products
/*
BAD PRACTISE
* IS TO USE QUERIES INSTEAD OF TABLES – THIS WILL SKIP THE INDEXES DEFINE ON THIS TABLE
(
SELECT * FROM
products
WHERE productDescription like ‘%coca%’ or products_model like ‘%coca%’ or qr_code like ‘%coca%’ or CAST(products_id AS varchar) = ‘coca’
) AS products
END */

left JOIN m_flag [l] ON l.id = products.statusId left JOIN category [C] ON C.category_id = products.CategoryId left JOIN customers [V] ON V.customers_id = products.supplierId left JOIN m_flag [D] ON D.id = products.deptId left JOIN m_flag [B] ON B.id = products.BrandId LEFT JOIN (SELECT productId,SUM(OPG) CLSG

/*BAD PRACTISE
* USE FUNCTIONS INSTEAD OF VARIABLES

–FROM dbo.SR_STK_BREAKUP(GETDATE(), GETDATE(),0, 0, 0, 0, 0, 0, 0, NULL, dbo.OPG_DT_FG(GETDATE()), GETDATE(), N’D’, N’Product’, N’Product’)
***** END ********


***** BAD PRACTISE *****
***** USE TRANSCTION FUNCTION FOR CALCULATING OPG AND CLOSING – For most of the functions there is a seaprate OPG function and OPG function is also use to return CLSG
CLSG = OPG of next day

–FROM dbo.SR_STK_BREAKUP(GETDATE(), GETDATE(),0, 0, 0, 0, 0, 0, 0, NULL, dbo.OPG_DT_FG(GETDATE()), GETDATE(), N’D’, N’Product’, N’Product’)
***** END ********

–FROM dbo.SR_STK_BREAKUP(@currentDate, @currentDate,0, 0, 0, 0, 0, 0, 0, NULL, @opgDtFgResult, @currentDate, N’D’, N’Product’, N’Product’) */
FROM dbo.SR_STK_OPG_BREAKUP(@clsgDate,0, 0, 0, 0, NULL,0, @opgDtFgResult, N’Product’, N’Product’)

GROUP BY productId)AS CLSG
ON CLSG.productId= products.products_id where productDescription like ‘%coca%’ or products_model like ‘%coca%’ or qr_code like ‘%coca%’ or CAST(products_id AS varchar) = ‘coca’

  

Leave a Reply

Your email address will not be published. Required fields are marked *