Script for Master DB to find accounts using Barcode Prefix

Script for Master DB to find accounts using Barcode Prefix

This script will allow you to find the accounts using the prefix range for barcode on IShipper. You would need to change the Seed prefix

 

USE master
CREATE TABLE #Dbs
(
DbName VARCHAR(MAX),
AccountNumber VARCHAR(MAX),
PostingLocation VARCHAR(MAX),
SeedPrefix VARCHAR(MAX)
)
DECLARE @SQLCommand VARCHAR(MAX)
SET @SQLCommand = '
use [?]
if exists (select name from sys.tables where name = ''DashboardData'')
BEGIN
INSERT INTO #Dbs
SELECT db_name(), AccountNumber, PostingLocation, SeedPrefix FROM IntegrationSeeds
WHERE SeedPrefix in (''BT'')
AND IsUsed = 0
END
'
EXEC sp_MSforeachdb @SQLCommand
SELECT * FROM #Dbs
DROP TABLE #Dbs