Skip to main content

Convert Sqlite to MSSQL Server

Chinese_PRC_CI_AS for Chinese

USE [master]
GO
ALTER DATABASE [Main_DB] COLLATE Chinese_PRC_CI_AS
GO

EXEC sp_MSforeachtable @command1="ALTER TABLE ? DISABLE TRIGGER ALL"

EXEC sp_MSforeachtable @command1="ALTER TABLE ? ENABLE TRIGGER ALL"


  1. by using Navicate, export the following setting table

image.png

image.png



2. check each sql file, remove ", and the time has issue 

delete from TableSet;

SET IDENTITY_INSERT TableSet ON;


SET IDENTITY_INSERT TableSet OFF;

3.


  
IF COL_LENGTH('OrderCombination', 'PId') IS NOT NULL
  dbcc checkident(OrderCombination,reseed,1000000)
ELSE  
  alter table OrderCombination add PId bigint identity(1000000,1);
  
  


IF COL_LENGTH('AccessMenu', 'PId') IS NOT NULL
  dbcc checkident(AccessMenu,reseed,1000000)
ELSE  
  alter table AccessMenu add PId bigint identity(1000000,1);

IF COL_LENGTH('Attendance', 'PId') IS NOT NULL
  dbcc checkident(Attendance,reseed,1000000)
ELSE  
  alter table Attendance add PId bigint identity(1000000,1);

IF COL_LENGTH('BankHead', 'PId') IS NOT NULL
  dbcc checkident(BankHead,reseed,1000000)
ELSE  
  alter table BankHead add PId bigint identity(1000000,1);

IF COL_LENGTH('BankTransaction', 'PId') IS NOT NULL
  dbcc checkident(BankTransaction,reseed,1000000)
ELSE  
  alter table BankTransaction add PId bigint identity(1000000,1);

IF COL_LENGTH('BookDetail', 'PId') IS NOT NULL
  dbcc checkident(BookDetail,reseed,1000000)
ELSE  
  alter table BookDetail add PId bigint identity(1000000,1);

IF COL_LENGTH('BookTable', 'PId') IS NOT NULL
  dbcc checkident(BookTable,reseed,1000000)
ELSE  
  alter table BookTable add PId bigint identity(1000000,1);

IF COL_LENGTH('ButtonsTable', 'PId') IS NOT NULL
  dbcc checkident(ButtonsTable,reseed,1000000)
ELSE  
  alter table ButtonsTable add PId bigint identity(1000000,1);

IF COL_LENGTH('CancelSalesHead', 'PId') IS NOT NULL
  dbcc checkident(CancelSalesHead,reseed,1000000)
ELSE  
  alter table CancelSalesHead add PId bigint identity(1000000,1);

IF COL_LENGTH('CancelSalesItem', 'PId') IS NOT NULL
  dbcc checkident(CancelSalesItem,reseed,1000000)
ELSE  
  alter table CancelSalesItem add PId bigint identity(1000000,1);

IF COL_LENGTH('CashDeclaration', 'PId') IS NOT NULL
  dbcc checkident(CashDeclaration,reseed,1000000)
ELSE  
  alter table CashDeclaration add PId bigint identity(1000000,1);

IF COL_LENGTH('CashFloatTable', 'PId') IS NOT NULL
  dbcc checkident(CashFloatTable,reseed,1000000)
ELSE  
  alter table CashFloatTable add PId bigint identity(1000000,1);

IF COL_LENGTH('Category', 'PId') IS NOT NULL
  dbcc checkident(Category,reseed,1000000)
ELSE  
  alter table Category add PId bigint identity(1000000,1);

IF COL_LENGTH('CategoryMenuItem', 'PId') IS NOT NULL
  dbcc checkident(CategoryMenuItem,reseed,1000000)
ELSE  
  alter table CategoryMenuItem add PId bigint identity(1000000,1);

IF COL_LENGTH('ChannelPaymentActivity', 'PId') IS NOT NULL
  dbcc checkident(ChannelPaymentActivity,reseed,1000000)
ELSE  
  alter table ChannelPaymentActivity add PId bigint identity(1000000,1);

IF COL_LENGTH('ChargeScope', 'PId') IS NOT NULL
  dbcc checkident(ChargeScope,reseed,1000000)
ELSE  
  alter table ChargeScope add PId bigint identity(1000000,1);

IF COL_LENGTH('Chart', 'PId') IS NOT NULL
  dbcc checkident(Chart,reseed,1000000)
ELSE  
  alter table Chart add PId bigint identity(1000000,1);

IF COL_LENGTH('CloudMenuPicture', 'PId') IS NOT NULL
  dbcc checkident(CloudMenuPicture,reseed,1000000)
ELSE  
  alter table CloudMenuPicture add PId bigint identity(1000000,1);

IF COL_LENGTH('CloudMenuSync', 'PId') IS NOT NULL
  dbcc checkident(CloudMenuSync,reseed,1000000)
ELSE  
  alter table CloudMenuSync add PId bigint identity(1000000,1);

IF COL_LENGTH('CloudMenuVersion', 'PId') IS NOT NULL
  dbcc checkident(CloudMenuVersion,reseed,1000000)
ELSE  
  alter table CloudMenuVersion add PId bigint identity(1000000,1);


IF COL_LENGTH('course', 'PId') IS NOT NULL
  dbcc checkident(course,reseed,1000000)
ELSE  
  alter table course add PId bigint identity(1000000,1);

IF COL_LENGTH('DBVersion', 'PId') IS NOT NULL
  dbcc checkident(DBVersion,reseed,1000000)
ELSE  
  alter table DBVersion add PId bigint identity(1000000,1);

IF COL_LENGTH('DefaultMenuDeal', 'PId') IS NOT NULL
  dbcc checkident(DefaultMenuDeal,reseed,1000000)
ELSE  
  alter table DefaultMenuDeal add PId bigint identity(1000000,1);

IF COL_LENGTH('DepositTable', 'PId') IS NOT NULL
  dbcc checkident(DepositTable,reseed,1000000)
ELSE  
  alter table DepositTable add PId bigint identity(1000000,1);

IF COL_LENGTH('DiscountRateTable', 'PId') IS NOT NULL
  dbcc checkident(DiscountRateTable,reseed,1000000)
ELSE  
  alter table DiscountRateTable add PId bigint identity(1000000,1);


IF COL_LENGTH('DrawerDevice', 'PId') IS NOT NULL
  dbcc checkident(DrawerDevice,reseed,1000000)
ELSE  
  alter table DrawerDevice add PId bigint identity(1000000,1);


IF COL_LENGTH('DrawerOpenRecordTable', 'PId') IS NOT NULL
  dbcc checkident(DrawerOpenRecordTable,reseed,1000000)
ELSE  
  alter table DrawerOpenRecordTable add PId bigint identity(1000000,1);

IF COL_LENGTH('EftLog', 'PId') IS NOT NULL
  dbcc checkident(EftLog,reseed,1000000)
ELSE  
  alter table EftLog add PId bigint identity(1000000,1);

IF COL_LENGTH('EftMachinePair', 'PId') IS NOT NULL
  dbcc checkident(EftMachinePair,reseed,1000000)
ELSE  
  alter table EftMachinePair add PId bigint identity(1000000,1);

IF COL_LENGTH('EftMerReceipt', 'PId') IS NOT NULL
  dbcc checkident(EftMerReceipt,reseed,1000000)
ELSE  
  alter table EftMerReceipt add PId bigint identity(1000000,1);

IF COL_LENGTH('EftSettlement', 'PId') IS NOT NULL
  dbcc checkident(EftSettlement,reseed,1000000)
ELSE  
  alter table EftSettlement add PId bigint identity(1000000,1);

IF COL_LENGTH('EftTransactionActive', 'PId') IS NOT NULL
  dbcc checkident(EftTransactionActive,reseed,1000000)
ELSE  
  alter table EftTransactionActive add PId bigint identity(1000000,1);

IF COL_LENGTH('ExpAcct', 'PId') IS NOT NULL
  dbcc checkident(ExpAcct,reseed,1000000)
ELSE  
  alter table ExpAcct add PId bigint identity(1000000,1);

IF COL_LENGTH('ExpDetail', 'PId') IS NOT NULL
  dbcc checkident(ExpDetail,reseed,1000000)
ELSE  
  alter table ExpDetail add PId bigint identity(1000000,1);

IF COL_LENGTH('Expenses', 'PId') IS NOT NULL
  dbcc checkident(Expenses,reseed,1000000)
ELSE  
  alter table Expenses add PId bigint identity(1000000,1);

IF COL_LENGTH('GiftCardSales', 'PId') IS NOT NULL
  dbcc checkident(GiftCardSales,reseed,1000000)
ELSE  
  alter table GiftCardSales add PId bigint identity(1000000,1);

IF COL_LENGTH('HoldHead', 'PId') IS NOT NULL
  dbcc checkident(HoldHead,reseed,1000000)
ELSE  
  alter table HoldHead add PId bigint identity(1000000,1);

IF COL_LENGTH('HoldItem', 'PId') IS NOT NULL
  dbcc checkident(HoldItem,reseed,1000000)
ELSE  
  alter table HoldItem add PId bigint identity(1000000,1);

IF COL_LENGTH('HolidayTable', 'PId') IS NOT NULL
  dbcc checkident(HolidayTable,reseed,1000000)
ELSE  
  alter table HolidayTable add PId bigint identity(1000000,1);

IF COL_LENGTH('IngredientsTable', 'PId') IS NOT NULL
  dbcc checkident(IngredientsTable,reseed,1000000)
ELSE  
  alter table IngredientsTable add PId bigint identity(1000000,1);


IF COL_LENGTH('InstructionLink', 'PId') IS NOT NULL
  dbcc checkident(InstructionLink,reseed,1000000)
ELSE  
  alter table InstructionLink add PId bigint identity(1000000,1);

IF COL_LENGTH('InstructionLinkGroup', 'PId') IS NOT NULL
  dbcc checkident(InstructionLinkGroup,reseed,1000000)
ELSE  
  alter table InstructionLinkGroup add PId bigint identity(1000000,1);

IF COL_LENGTH('IPPermission', 'PId') IS NOT NULL
  dbcc checkident(IPPermission,reseed,1000000)
ELSE  
  alter table IPPermission add PId bigint identity(1000000,1);

IF COL_LENGTH('ItemGroupTable', 'PId') IS NOT NULL
  dbcc checkident(ItemGroupTable,reseed,1000000)
ELSE  
  alter table ItemGroupTable add PId bigint identity(1000000,1);


IF COL_LENGTH('KitchenScreen', 'PId') IS NOT NULL
  dbcc checkident(KitchenScreen,reseed,1000000)
ELSE  
  alter table KitchenScreen add PId bigint identity(1000000,1);

IF COL_LENGTH('LoyaltyPoints', 'PId') IS NOT NULL
  dbcc checkident(LoyaltyPoints,reseed,1000000)
ELSE  
  alter table LoyaltyPoints add PId bigint identity(1000000,1);

IF COL_LENGTH('MachineID', 'PId') IS NOT NULL
  dbcc checkident(MachineID,reseed,1000000)
ELSE  
  alter table MachineID add PId bigint identity(1000000,1);



IF COL_LENGTH('MealPackage', 'PId') IS NOT NULL
  dbcc checkident(MealPackage,reseed,1000000)
ELSE  
  alter table MealPackage add PId bigint identity(1000000,1);

IF COL_LENGTH('Menu', 'PId') IS NOT NULL
  dbcc checkident(Menu,reseed,1000000)
ELSE  
  alter table Menu add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuGroupLinkCategory', 'PId') IS NOT NULL
  dbcc checkident(MenuGroupLinkCategory,reseed,1000000)
ELSE  
  alter table MenuGroupLinkCategory add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuGroupTable', 'PId') IS NOT NULL
  dbcc checkident(MenuGroupTable,reseed,1000000)
ELSE  
  alter table MenuGroupTable add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuGroupTimes', 'PId') IS NOT NULL
  dbcc checkident(MenuGroupTimes,reseed,1000000)
ELSE  
  alter table MenuGroupTimes add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuItem', 'PId') IS NOT NULL
  dbcc checkident(MenuItem,reseed,1000000)
ELSE  
  alter table MenuItem add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuItemRelation', 'PId') IS NOT NULL
  dbcc checkident(MenuItemRelation,reseed,1000000)
ELSE  
  alter table MenuItemRelation add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuSyncLog', 'PId') IS NOT NULL
  dbcc checkident(MenuSyncLog,reseed,1000000)
ELSE  
  alter table MenuSyncLog add PId bigint identity(1000000,1);

IF COL_LENGTH('messi', 'PId') IS NOT NULL
  dbcc checkident(messi,reseed,1000000)
ELSE  
  alter table messi add PId bigint identity(1000000,1);


IF COL_LENGTH('OnlineOrderReceiver', 'PId') IS NOT NULL
  dbcc checkident(OnlineOrderReceiver,reseed,1000000)
ELSE  
  alter table OnlineOrderReceiver add PId bigint identity(1000000,1);



IF COL_LENGTH('OrderH', 'PId') IS NOT NULL
  dbcc checkident(OrderH,reseed,1000000)
ELSE  
  alter table OrderH add PId bigint identity(1000000,1);

IF COL_LENGTH('OrderI', 'PId') IS NOT NULL
  dbcc checkident(OrderI,reseed,1000000)
ELSE  
  alter table OrderI add PId bigint identity(1000000,1);

IF COL_LENGTH('OrderOpRecord', 'PId') IS NOT NULL
  dbcc checkident(OrderOpRecord,reseed,1000000)
ELSE  
  alter table OrderOpRecord add PId bigint identity(1000000,1);


IF COL_LENGTH('PayAcct', 'PId') IS NOT NULL
  dbcc checkident(PayAcct,reseed,1000000)
ELSE  
  alter table PayAcct add PId bigint identity(1000000,1);

IF COL_LENGTH('Payment', 'PId') IS NOT NULL
  dbcc checkident(Payment,reseed,1000000)
ELSE  
  alter table Payment add PId bigint identity(1000000,1);

IF COL_LENGTH('PayOutTable', 'PId') IS NOT NULL
  dbcc checkident(PayOutTable,reseed,1000000)
ELSE  
  alter table PayOutTable add PId bigint identity(1000000,1);

IF COL_LENGTH('PictureMeta', 'PId') IS NOT NULL
  dbcc checkident(PictureMeta,reseed,1000000)
ELSE  
  alter table PictureMeta add PId bigint identity(1000000,1);

IF COL_LENGTH('PresetNote', 'PId') IS NOT NULL
  dbcc checkident(PresetNote,reseed,1000000)
ELSE  
  alter table PresetNote add PId bigint identity(1000000,1);

IF COL_LENGTH('PresetNoteGroup', 'PId') IS NOT NULL
  dbcc checkident(PresetNoteGroup,reseed,1000000)
ELSE  
  alter table PresetNoteGroup add PId bigint identity(1000000,1);

IF COL_LENGTH('PresetNotes', 'PId') IS NOT NULL
  dbcc checkident(PresetNotes,reseed,1000000)
ELSE  
  alter table PresetNotes add PId bigint identity(1000000,1);

IF COL_LENGTH('PrintCondition', 'PId') IS NOT NULL
  dbcc checkident(PrintCondition,reseed,1000000)
ELSE  
  alter table PrintCondition add PId bigint identity(1000000,1);

IF COL_LENGTH('PrinterDevice', 'PId') IS NOT NULL
  dbcc checkident(PrinterDevice,reseed,1000000)
ELSE  
  alter table PrinterDevice add PId bigint identity(1000000,1);

IF COL_LENGTH('PrinterDeviceItem', 'PId') IS NOT NULL
  dbcc checkident(PrinterDeviceItem,reseed,1000000)
ELSE  
  alter table PrinterDeviceItem add PId bigint identity(1000000,1);

IF COL_LENGTH('printertask', 'PId') IS NOT NULL
  dbcc checkident(printertask,reseed,1000000)
ELSE  
  alter table printertask add PId bigint identity(1000000,1);


IF COL_LENGTH('Profile', 'PId') IS NOT NULL
  dbcc checkident(Profile,reseed,1000000)
ELSE  
  alter table Profile add PId bigint identity(1000000,1);

IF COL_LENGTH('PurchaseHead', 'PId') IS NOT NULL
  dbcc checkident(PurchaseHead,reseed,1000000)
ELSE  
  alter table PurchaseHead add PId bigint identity(1000000,1);

IF COL_LENGTH('PurchaseItem', 'PId') IS NOT NULL
  dbcc checkident(PurchaseItem,reseed,1000000)
ELSE  
  alter table PurchaseItem add PId bigint identity(1000000,1);

IF COL_LENGTH('RecvAcct', 'PId') IS NOT NULL
  dbcc checkident(RecvAcct,reseed,1000000)
ELSE  
  alter table RecvAcct add PId bigint identity(1000000,1);

IF COL_LENGTH('SecondDisplayParams', 'PId') IS NOT NULL
  dbcc checkident(SecondDisplayParams,reseed,1000000)
ELSE  
  alter table SecondDisplayParams add PId bigint identity(1000000,1);

IF COL_LENGTH('SelfOrderingEvents', 'PId') IS NOT NULL
  dbcc checkident(SelfOrderingEvents,reseed,1000000)
ELSE  
  alter table SelfOrderingEvents add PId bigint identity(1000000,1);


IF COL_LENGTH('specialdaytable', 'PId') IS NOT NULL
  dbcc checkident(specialdaytable,reseed,1000000)
ELSE  
  alter table specialdaytable add PId bigint identity(1000000,1);

IF COL_LENGTH('StockH', 'PId') IS NOT NULL
  dbcc checkident(StockH,reseed,1000000)
ELSE  
  alter table StockH add PId bigint identity(1000000,1);

IF COL_LENGTH('StockI', 'PId') IS NOT NULL
  dbcc checkident(StockI,reseed,1000000)
ELSE  
  alter table StockI add PId bigint identity(1000000,1);

IF COL_LENGTH('StockLinkTable', 'PId') IS NOT NULL
  dbcc checkident(StockLinkTable,reseed,1000000)
ELSE  
  alter table StockLinkTable add PId bigint identity(1000000,1);

IF COL_LENGTH('StockTable', 'PId') IS NOT NULL
  dbcc checkident(StockTable,reseed,1000000)
ELSE  
  alter table StockTable add PId bigint identity(1000000,1);

IF COL_LENGTH('StockTakeHead', 'PId') IS NOT NULL
  dbcc checkident(StockTakeHead,reseed,1000000)
ELSE  
  alter table StockTakeHead add PId bigint identity(1000000,1);

IF COL_LENGTH('StockTakeItem', 'PId') IS NOT NULL
  dbcc checkident(StockTakeItem,reseed,1000000)
ELSE  
  alter table StockTakeItem add PId bigint identity(1000000,1);

IF COL_LENGTH('StreetTable', 'PId') IS NOT NULL
  dbcc checkident(StreetTable,reseed,1000000)
ELSE  
  alter table StreetTable add PId bigint identity(1000000,1);

IF COL_LENGTH('SubItemGroup', 'PId') IS NOT NULL
  dbcc checkident(SubItemGroup,reseed,1000000)
ELSE  
  alter table SubItemGroup add PId bigint identity(1000000,1);

IF COL_LENGTH('SubMenuLinkDetail', 'PId') IS NOT NULL
  dbcc checkident(SubMenuLinkDetail,reseed,1000000)
ELSE  
  alter table SubMenuLinkDetail add PId bigint identity(1000000,1);

IF COL_LENGTH('SubMenuLinkHead', 'PId') IS NOT NULL
  dbcc checkident(SubMenuLinkHead,reseed,1000000)
ELSE  
  alter table SubMenuLinkHead add PId bigint identity(1000000,1);

IF COL_LENGTH('Supplier', 'PId') IS NOT NULL
  dbcc checkident(Supplier,reseed,1000000)
ELSE  
  alter table Supplier add PId bigint identity(1000000,1);

IF COL_LENGTH('SupplierMemo', 'PId') IS NOT NULL
  dbcc checkident(SupplierMemo,reseed,1000000)
ELSE  
  alter table SupplierMemo add PId bigint identity(1000000,1);

IF COL_LENGTH('SysLog', 'PId') IS NOT NULL
  dbcc checkident(SysLog,reseed,1000000)
ELSE  
  alter table SysLog add PId bigint identity(1000000,1);

IF COL_LENGTH('sysparameter', 'PId') IS NOT NULL
  dbcc checkident(sysparameter,reseed,1000000)
ELSE  
  alter table sysparameter add PId bigint identity(1000000,1);

IF COL_LENGTH('TablePage', 'PId') IS NOT NULL
  dbcc checkident(TablePage,reseed,1000000)
ELSE  
  alter table TablePage add PId bigint identity(1000000,1);

IF COL_LENGTH('TableSet', 'PId') IS NOT NULL
  dbcc checkident(TableSet,reseed,1000000)
ELSE  
  alter table TableSet add PId bigint identity(1000000,1);



IF COL_LENGTH('TrackingSource', 'PId') IS NOT NULL
  dbcc checkident(TrackingSource,reseed,1000000)
ELSE  
  alter table TrackingSource add PId bigint identity(1000000,1);

IF COL_LENGTH('TrackingSync', 'PId') IS NOT NULL
  dbcc checkident(TrackingSync,reseed,1000000)
ELSE  
  alter table TrackingSync add PId bigint identity(1000000,1);

IF COL_LENGTH('TyroReconciliation', 'PId') IS NOT NULL
  dbcc checkident(TyroReconciliation,reseed,1000000)
ELSE  
  alter table TyroReconciliation add PId bigint identity(1000000,1);

IF COL_LENGTH('TyroReconcilTransaction', 'PId') IS NOT NULL
  dbcc checkident(TyroReconcilTransaction,reseed,1000000)
ELSE  
  alter table TyroReconcilTransaction add PId bigint identity(1000000,1);

IF COL_LENGTH('TyroReport', 'PId') IS NOT NULL
  dbcc checkident(TyroReport,reseed,1000000)
ELSE  
  alter table TyroReport add PId bigint identity(1000000,1);

IF COL_LENGTH('UserGroupTable', 'PId') IS NOT NULL
  dbcc checkident(UserGroupTable,reseed,1000000)
ELSE  
  alter table UserGroupTable add PId bigint identity(1000000,1);

IF COL_LENGTH('Version', 'PId') IS NOT NULL
  dbcc checkident(Version,reseed,1000000)
ELSE  
  alter table Version add PId bigint identity(1000000,1);

IF COL_LENGTH('VIPTable', 'PId') IS NOT NULL
  dbcc checkident(VIPTable,reseed,1000000)
ELSE  
  alter table VIPTable add PId bigint identity(1000000,1);

IF COL_LENGTH('VoidReasonTable', 'PId') IS NOT NULL
  dbcc checkident(VoidReasonTable,reseed,1000000)
ELSE  
  alter table VoidReasonTable add PId bigint identity(1000000,1);

IF COL_LENGTH('WastageHead', 'PId') IS NOT NULL
  dbcc checkident(WastageHead,reseed,1000000)
ELSE  
  alter table WastageHead add PId bigint identity(1000000,1);

IF COL_LENGTH('WastageItem', 'PId') IS NOT NULL
  dbcc checkident(WastageItem,reseed,1000000)
ELSE  
  alter table WastageItem add PId bigint identity(1000000,1);
  
  


replace date & time,

'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\.\d*'

'$1'























--------------------------------




IF COL_LENGTH('AccessMenu', 'PId') IS NOT NULL
  dbcc checkident(AccessMenu,reseed,1000000)
ELSE  
  alter table AccessMenu add PId bigint identity(1000000,1);

IF COL_LENGTH('Attendance', 'PId') IS NOT NULL
  dbcc checkident(Attendance,reseed,1000000)
ELSE  
  alter table Attendance add PId bigint identity(1000000,1);

IF COL_LENGTH('BankHead', 'PId') IS NOT NULL
  dbcc checkident(BankHead,reseed,1000000)
ELSE  
  alter table BankHead add PId bigint identity(1000000,1);

IF COL_LENGTH('BankTransaction', 'PId') IS NOT NULL
  dbcc checkident(BankTransaction,reseed,1000000)
ELSE  
  alter table BankTransaction add PId bigint identity(1000000,1);

IF COL_LENGTH('BookDetail', 'PId') IS NOT NULL
  dbcc checkident(BookDetail,reseed,1000000)
ELSE  
  alter table BookDetail add PId bigint identity(1000000,1);

IF COL_LENGTH('BookTable', 'PId') IS NOT NULL
  dbcc checkident(BookTable,reseed,1000000)
ELSE  
  alter table BookTable add PId bigint identity(1000000,1);

IF COL_LENGTH('ButtonsTable', 'PId') IS NOT NULL
  dbcc checkident(ButtonsTable,reseed,1000000)
ELSE  
  alter table ButtonsTable add PId bigint identity(1000000,1);

IF COL_LENGTH('CancelSalesHead', 'PId') IS NOT NULL
  dbcc checkident(CancelSalesHead,reseed,1000000)
ELSE  
  alter table CancelSalesHead add PId bigint identity(1000000,1);

IF COL_LENGTH('CancelSalesItem', 'PId') IS NOT NULL
  dbcc checkident(CancelSalesItem,reseed,1000000)
ELSE  
  alter table CancelSalesItem add PId bigint identity(1000000,1);

IF COL_LENGTH('CashDeclaration', 'PId') IS NOT NULL
  dbcc checkident(CashDeclaration,reseed,1000000)
ELSE  
  alter table CashDeclaration add PId bigint identity(1000000,1);

IF COL_LENGTH('CashFloatTable', 'PId') IS NOT NULL
  dbcc checkident(CashFloatTable,reseed,1000000)
ELSE  
  alter table CashFloatTable add PId bigint identity(1000000,1);

IF COL_LENGTH('Category', 'PId') IS NOT NULL
  dbcc checkident(Category,reseed,1000000)
ELSE  
  alter table Category add PId bigint identity(1000000,1);

IF COL_LENGTH('CategoryMenuItem', 'PId') IS NOT NULL
  dbcc checkident(CategoryMenuItem,reseed,1000000)
ELSE  
  alter table CategoryMenuItem add PId bigint identity(1000000,1);

IF COL_LENGTH('ChannelPaymentActivity', 'PId') IS NOT NULL
  dbcc checkident(ChannelPaymentActivity,reseed,1000000)
ELSE  
  alter table ChannelPaymentActivity add PId bigint identity(1000000,1);

IF COL_LENGTH('ChargeScope', 'PId') IS NOT NULL
  dbcc checkident(ChargeScope,reseed,1000000)
ELSE  
  alter table ChargeScope add PId bigint identity(1000000,1);

IF COL_LENGTH('Chart', 'PId') IS NOT NULL
  dbcc checkident(Chart,reseed,1000000)
ELSE  
  alter table Chart add PId bigint identity(1000000,1);

IF COL_LENGTH('CloudMenuPicture', 'PId') IS NOT NULL
  dbcc checkident(CloudMenuPicture,reseed,1000000)
ELSE  
  alter table CloudMenuPicture add PId bigint identity(1000000,1);

IF COL_LENGTH('CloudMenuSync', 'PId') IS NOT NULL
  dbcc checkident(CloudMenuSync,reseed,1000000)
ELSE  
  alter table CloudMenuSync add PId bigint identity(1000000,1);

IF COL_LENGTH('CloudMenuVersion', 'PId') IS NOT NULL
  dbcc checkident(CloudMenuVersion,reseed,1000000)
ELSE  
  alter table CloudMenuVersion add PId bigint identity(1000000,1);

IF COL_LENGTH('CommandControl', 'PId') IS NOT NULL
  dbcc checkident(CommandControl,reseed,1000000)
ELSE  
  alter table CommandControl add PId bigint identity(1000000,1);

IF COL_LENGTH('course', 'PId') IS NOT NULL
  dbcc checkident(course,reseed,1000000)
ELSE  
  alter table course add PId bigint identity(1000000,1);

IF COL_LENGTH('DBVersion', 'PId') IS NOT NULL
  dbcc checkident(DBVersion,reseed,1000000)
ELSE  
  alter table DBVersion add PId bigint identity(1000000,1);

IF COL_LENGTH('DefaultMenuDeal', 'PId') IS NOT NULL
  dbcc checkident(DefaultMenuDeal,reseed,1000000)
ELSE  
  alter table DefaultMenuDeal add PId bigint identity(1000000,1);

IF COL_LENGTH('DepositTable', 'PId') IS NOT NULL
  dbcc checkident(DepositTable,reseed,1000000)
ELSE  
  alter table DepositTable add PId bigint identity(1000000,1);

IF COL_LENGTH('DiscountRateTable', 'PId') IS NOT NULL
  dbcc checkident(DiscountRateTable,reseed,1000000)
ELSE  
  alter table DiscountRateTable add PId bigint identity(1000000,1);

IF COL_LENGTH('DiscountSchema', 'PId') IS NOT NULL
  dbcc checkident(DiscountSchema,reseed,1000000)
ELSE  
  alter table DiscountSchema add PId bigint identity(1000000,1);

IF COL_LENGTH('DrawerDevice', 'PId') IS NOT NULL
  dbcc checkident(DrawerDevice,reseed,1000000)
ELSE  
  alter table DrawerDevice add PId bigint identity(1000000,1);

IF COL_LENGTH('draweropenrecords', 'PId') IS NOT NULL
  dbcc checkident(draweropenrecords,reseed,1000000)
ELSE  
  alter table draweropenrecords add PId bigint identity(1000000,1);

IF COL_LENGTH('DrawerOpenRecordTable', 'PId') IS NOT NULL
  dbcc checkident(DrawerOpenRecordTable,reseed,1000000)
ELSE  
  alter table DrawerOpenRecordTable add PId bigint identity(1000000,1);

IF COL_LENGTH('EftLog', 'PId') IS NOT NULL
  dbcc checkident(EftLog,reseed,1000000)
ELSE  
  alter table EftLog add PId bigint identity(1000000,1);

IF COL_LENGTH('EftMachinePair', 'PId') IS NOT NULL
  dbcc checkident(EftMachinePair,reseed,1000000)
ELSE  
  alter table EftMachinePair add PId bigint identity(1000000,1);

IF COL_LENGTH('EftMerReceipt', 'PId') IS NOT NULL
  dbcc checkident(EftMerReceipt,reseed,1000000)
ELSE  
  alter table EftMerReceipt add PId bigint identity(1000000,1);

IF COL_LENGTH('EftSettlement', 'PId') IS NOT NULL
  dbcc checkident(EftSettlement,reseed,1000000)
ELSE  
  alter table EftSettlement add PId bigint identity(1000000,1);

IF COL_LENGTH('EftTransactionActive', 'PId') IS NOT NULL
  dbcc checkident(EftTransactionActive,reseed,1000000)
ELSE  
  alter table EftTransactionActive add PId bigint identity(1000000,1);

IF COL_LENGTH('ExpAcct', 'PId') IS NOT NULL
  dbcc checkident(ExpAcct,reseed,1000000)
ELSE  
  alter table ExpAcct add PId bigint identity(1000000,1);

IF COL_LENGTH('ExpDetail', 'PId') IS NOT NULL
  dbcc checkident(ExpDetail,reseed,1000000)
ELSE  
  alter table ExpDetail add PId bigint identity(1000000,1);

IF COL_LENGTH('Expenses', 'PId') IS NOT NULL
  dbcc checkident(Expenses,reseed,1000000)
ELSE  
  alter table Expenses add PId bigint identity(1000000,1);

IF COL_LENGTH('GiftCardSales', 'PId') IS NOT NULL
  dbcc checkident(GiftCardSales,reseed,1000000)
ELSE  
  alter table GiftCardSales add PId bigint identity(1000000,1);

IF COL_LENGTH('HoldHead', 'PId') IS NOT NULL
  dbcc checkident(HoldHead,reseed,1000000)
ELSE  
  alter table HoldHead add PId bigint identity(1000000,1);

IF COL_LENGTH('HoldItem', 'PId') IS NOT NULL
  dbcc checkident(HoldItem,reseed,1000000)
ELSE  
  alter table HoldItem add PId bigint identity(1000000,1);

IF COL_LENGTH('HolidayTable', 'PId') IS NOT NULL
  dbcc checkident(HolidayTable,reseed,1000000)
ELSE  
  alter table HolidayTable add PId bigint identity(1000000,1);

IF COL_LENGTH('IngredientsTable', 'PId') IS NOT NULL
  dbcc checkident(IngredientsTable,reseed,1000000)
ELSE  
  alter table IngredientsTable add PId bigint identity(1000000,1);

IF COL_LENGTH('InitialTrackingVersion', 'PId') IS NOT NULL
  dbcc checkident(InitialTrackingVersion,reseed,1000000)
ELSE  
  alter table InitialTrackingVersion add PId bigint identity(1000000,1);

IF COL_LENGTH('InstructionLink', 'PId') IS NOT NULL
  dbcc checkident(InstructionLink,reseed,1000000)
ELSE  
  alter table InstructionLink add PId bigint identity(1000000,1);

IF COL_LENGTH('InstructionLinkGroup', 'PId') IS NOT NULL
  dbcc checkident(InstructionLinkGroup,reseed,1000000)
ELSE  
  alter table InstructionLinkGroup add PId bigint identity(1000000,1);

IF COL_LENGTH('IPPermission', 'PId') IS NOT NULL
  dbcc checkident(IPPermission,reseed,1000000)
ELSE  
  alter table IPPermission add PId bigint identity(1000000,1);

IF COL_LENGTH('ItemGroupTable', 'PId') IS NOT NULL
  dbcc checkident(ItemGroupTable,reseed,1000000)
ELSE  
  alter table ItemGroupTable add PId bigint identity(1000000,1);

IF COL_LENGTH('KitchenDoneActivity', 'PId') IS NOT NULL
  dbcc checkident(KitchenDoneActivity,reseed,1000000)
ELSE  
  alter table KitchenDoneActivity add PId bigint identity(1000000,1);

IF COL_LENGTH('KitchenScreen', 'PId') IS NOT NULL
  dbcc checkident(KitchenScreen,reseed,1000000)
ELSE  KitchenKitchen
  alter table KitchenScreen add PId bigint identity(1000000,1);

IF COL_LENGTH('LoyaltyPoints', 'PId') IS NOT NULL
  dbcc checkident(LoyaltyPoints,reseed,1000000)
ELSE  
  alter table LoyaltyPoints add PId bigint identity(1000000,1);

IF COL_LENGTH('MachineID', 'PId') IS NOT NULL
  dbcc checkident(MachineID,reseed,1000000)
ELSE  
  alter table MachineID add PId bigint identity(1000000,1);

IF COL_LENGTH('MachineLinkTableGroup', 'PId') IS NOT NULL
  dbcc checkident(MachineLinkTableGroup,reseed,1000000)
ELSE  
  alter table MachineLinkTableGroup add PId bigint identity(1000000,1);

IF COL_LENGTH('MealPackage', 'PId') IS NOT NULL
  dbcc checkident(MealPackage,reseed,1000000)
ELSE  
  alter table MealPackage add PId bigint identity(1000000,1);

IF COL_LENGTH('Menu', 'PId') IS NOT NULL
  dbcc checkident(Menu,reseed,1000000)
ELSE  
  alter table Menu add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuGroupLinkCategory', 'PId') IS NOT NULL
  dbcc checkident(MenuGroupLinkCategory,reseed,1000000)
ELSE  
  alter table MenuGroupLinkCategory add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuGroupTable', 'PId') IS NOT NULL
  dbcc checkident(MenuGroupTable,reseed,1000000)
ELSE  
  alter table MenuGroupTable add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuGroupTimes', 'PId') IS NOT NULL
  dbcc checkident(MenuGroupTimes,reseed,1000000)
ELSE  
  alter table MenuGroupTimes add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuItem', 'PId') IS NOT NULL
  dbcc checkident(MenuItem,reseed,1000000)
ELSE  
  alter table MenuItem add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuItemRelation', 'PId') IS NOT NULL
  dbcc checkident(MenuItemRelation,reseed,1000000)
ELSE  
  alter table MenuItemRelation add PId bigint identity(1000000,1);

IF COL_LENGTH('MenuSyncLog', 'PId') IS NOT NULL
  dbcc checkident(MenuSyncLog,reseed,1000000)
ELSE  
  alter table MenuSyncLog add PId bigint identity(1000000,1);

IF COL_LENGTH('messi', 'PId') IS NOT NULL
  dbcc checkident(messi,reseed,1000000)
ELSE  
  alter table messi add PId bigint identity(1000000,1);

IF COL_LENGTH('Mx51MachinePair', 'PId') IS NOT NULL
  dbcc checkident(Mx51MachinePair,reseed,1000000)
ELSE  
  alter table Mx51MachinePair add PId bigint identity(1000000,1);

IF COL_LENGTH('OnlineOrderReceiver', 'PId') IS NOT NULL
  dbcc checkident(OnlineOrderReceiver,reseed,1000000)
ELSE  
  alter table OnlineOrderReceiver add PId bigint identity(1000000,1);

IF COL_LENGTH('OrderCombination', 'PId') IS NOT NULL
  dbcc checkident(OrderCombination,reseed,1000000)
ELSE  
  alter table OrderCombination add PId bigint identity(1000000,1);

IF COL_LENGTH('OrderH', 'PId') IS NOT NULL
  dbcc checkident(OrderH,reseed,1000000)
ELSE  
  alter table OrderH add PId bigint identity(1000000,1);

IF COL_LENGTH('OrderI', 'PId') IS NOT NULL
  dbcc checkident(OrderI,reseed,1000000)
ELSE  
  alter table OrderI add PId bigint identity(1000000,1);

IF COL_LENGTH('OrderOpRecord', 'PId') IS NOT NULL
  dbcc checkident(OrderOpRecord,reseed,1000000)
ELSE  
  alter table OrderOpRecord add PId bigint identity(1000000,1);

IF COL_LENGTH('OrganizationSetting', 'PId') IS NOT NULL
  dbcc checkident(OrganizationSetting,reseed,1000000)
ELSE  
  alter table OrganizationSetting add PId bigint identity(1000000,1);

IF COL_LENGTH('PayAcct', 'PId') IS NOT NULL
  dbcc checkident(PayAcct,reseed,1000000)
ELSE  
  alter table PayAcct add PId bigint identity(1000000,1);

IF COL_LENGTH('Payment', 'PId') IS NOT NULL
  dbcc checkident(Payment,reseed,1000000)
ELSE  
  alter table Payment add PId bigint identity(1000000,1);

IF COL_LENGTH('PayOutTable', 'PId') IS NOT NULL
  dbcc checkident(PayOutTable,reseed,1000000)
ELSE  
  alter table PayOutTable add PId bigint identity(1000000,1);

IF COL_LENGTH('PictureMeta', 'PId') IS NOT NULL
  dbcc checkident(PictureMeta,reseed,1000000)
ELSE  
  alter table PictureMeta add PId bigint identity(1000000,1);

IF COL_LENGTH('PresetNote', 'PId') IS NOT NULL
  dbcc checkident(PresetNote,reseed,1000000)
ELSE  
  alter table PresetNote add PId bigint identity(1000000,1);

IF COL_LENGTH('PresetNoteGroup', 'PId') IS NOT NULL
  dbcc checkident(PresetNoteGroup,reseed,1000000)
ELSE  
  alter table PresetNoteGroup add PId bigint identity(1000000,1);

IF COL_LENGTH('PresetNotes', 'PId') IS NOT NULL
  dbcc checkident(PresetNotes,reseed,1000000)
ELSE  
  alter table PresetNotes add PId bigint identity(1000000,1);

IF COL_LENGTH('PrintCondition', 'PId') IS NOT NULL
  dbcc checkident(PrintCondition,reseed,1000000)
ELSE  
  alter table PrintCondition add PId bigint identity(1000000,1);

IF COL_LENGTH('PrinterDevice', 'PId') IS NOT NULL
  dbcc checkident(PrinterDevice,reseed,1000000)
ELSE  
  alter table PrinterDevice add PId bigint identity(1000000,1);

IF COL_LENGTH('PrinterDeviceItem', 'PId') IS NOT NULL
  dbcc checkident(PrinterDeviceItem,reseed,1000000)
ELSE  
  alter table PrinterDeviceItem add PId bigint identity(1000000,1);

IF COL_LENGTH('printertask', 'PId') IS NOT NULL
  dbcc checkident(printertask,reseed,1000000)
ELSE  
  alter table printertask add PId bigint identity(1000000,1);

IF COL_LENGTH('printjob', 'PId') IS NOT NULL
  dbcc checkident(printjob,reseed,1000000)
ELSE  
  alter table printjob add PId bigint identity(1000000,1);

IF COL_LENGTH('Profile', 'PId') IS NOT NULL
  dbcc checkident(Profile,reseed,1000000)
ELSE  
  alter table Profile add PId bigint identity(1000000,1);

IF COL_LENGTH('PurchaseHead', 'PId') IS NOT NULL
  dbcc checkident(PurchaseHead,reseed,1000000)
ELSE  
  alter table PurchaseHead add PId bigint identity(1000000,1);

IF COL_LENGTH('PurchaseItem', 'PId') IS NOT NULL
  dbcc checkident(PurchaseItem,reseed,1000000)
ELSE  
  alter table PurchaseItem add PId bigint identity(1000000,1);

IF COL_LENGTH('RecvAcct', 'PId') IS NOT NULL
  dbcc checkident(RecvAcct,reseed,1000000)
ELSE  
  alter table RecvAcct add PId bigint identity(1000000,1);

IF COL_LENGTH('SecondDisplayParams', 'PId') IS NOT NULL
  dbcc checkident(SecondDisplayParams,reseed,1000000)
ELSE  
  alter table SecondDisplayParams add PId bigint identity(1000000,1);

IF COL_LENGTH('SelfOrderingEvents', 'PId') IS NOT NULL
  dbcc checkident(SelfOrderingEvents,reseed,1000000)
ELSE  
  alter table SelfOrderingEvents add PId bigint identity(1000000,1);

IF COL_LENGTH('SequenceID', 'PId') IS NOT NULL
  dbcc checkident(SequenceID,reseed,1000000)
ELSE  
  alter table SequenceID add PId bigint identity(1000000,1);

IF COL_LENGTH('specialdaytable', 'PId') IS NOT NULL
  dbcc checkident(specialdaytable,reseed,1000000)
ELSE  
  alter table specialdaytable add PId bigint identity(1000000,1);

IF COL_LENGTH('StockH', 'PId') IS NOT NULL
  dbcc checkident(StockH,reseed,1000000)
ELSE  
  alter table StockH add PId bigint identity(1000000,1);

IF COL_LENGTH('StockI', 'PId') IS NOT NULL
  dbcc checkident(StockI,reseed,1000000)
ELSE  
  alter table StockI add PId bigint identity(1000000,1);

IF COL_LENGTH('StockLinkTable', 'PId') IS NOT NULL
  dbcc checkident(StockLinkTable,reseed,1000000)
ELSE  
  alter table StockLinkTable add PId bigint identity(1000000,1);

IF COL_LENGTH('StockTable', 'PId') IS NOT NULL
  dbcc checkident(StockTable,reseed,1000000)
ELSE  
  alter table StockTable add PId bigint identity(1000000,1);

IF COL_LENGTH('StockTakeHead', 'PId') IS NOT NULL
  dbcc checkident(StockTakeHead,reseed,1000000)
ELSE  
  alter table StockTakeHead add PId bigint identity(1000000,1);

IF COL_LENGTH('StockTakeItem', 'PId') IS NOT NULL
  dbcc checkident(StockTakeItem,reseed,1000000)
ELSE  
  alter table StockTakeItem add PId bigint identity(1000000,1);

IF COL_LENGTH('StreetTable', 'PId') IS NOT NULL
  dbcc checkident(StreetTable,reseed,1000000)
ELSE  
  alter table StreetTable add PId bigint identity(1000000,1);

IF COL_LENGTH('SubItemGroup', 'PId') IS NOT NULL
  dbcc checkident(SubItemGroup,reseed,1000000)
ELSE  
  alter table SubItemGroup add PId bigint identity(1000000,1);

IF COL_LENGTH('SubMenuLinkDetail', 'PId') IS NOT NULL
  dbcc checkident(SubMenuLinkDetail,reseed,1000000)
ELSE  
  alter table SubMenuLinkDetail add PId bigint identity(1000000,1);

IF COL_LENGTH('SubMenuLinkHead', 'PId') IS NOT NULL
  dbcc checkident(SubMenuLinkHead,reseed,1000000)
ELSE  
  alter table SubMenuLinkHead add PId bigint identity(1000000,1);

IF COL_LENGTH('Supplier', 'PId') IS NOT NULL
  dbcc checkident(Supplier,reseed,1000000)
ELSE  
  alter table Supplier add PId bigint identity(1000000,1);

IF COL_LENGTH('SupplierMemo', 'PId') IS NOT NULL
  dbcc checkident(SupplierMemo,reseed,1000000)
ELSE  
  alter table SupplierMemo add PId bigint identity(1000000,1);

IF COL_LENGTH('SysLog', 'PId') IS NOT NULL
  dbcc checkident(SysLog,reseed,1000000)
ELSE  
  alter table SysLog add PId bigint identity(1000000,1);

IF COL_LENGTH('sysparameter', 'PId') IS NOT NULL
  dbcc checkident(sysparameter,reseed,1000000)
ELSE  
  alter table sysparameter add PId bigint identity(1000000,1);

IF COL_LENGTH('TablePage', 'PId') IS NOT NULL
  dbcc checkident(TablePage,reseed,1000000)
ELSE  
  alter table TablePage add PId bigint identity(1000000,1);

IF COL_LENGTH('TableSet', 'PId') IS NOT NULL
  dbcc checkident(TableSet,reseed,1000000)
ELSE  
  alter table TableSet add PId bigint identity(1000000,1);

IF COL_LENGTH('TeamsOrder', 'PId') IS NOT NULL
  dbcc checkident(TeamsOrder,reseed,1000000)
ELSE  
  alter table TeamsOrder add PId bigint identity(1000000,1);

IF COL_LENGTH('trackingevent', 'PId') IS NOT NULL
  dbcc checkident(trackingevent,reseed,1000000)
ELSE  
  alter table trackingevent add PId bigint identity(1000000,1);

IF COL_LENGTH('trackingresource', 'PId') IS NOT NULL
  dbcc checkident(trackingresource,reseed,1000000)
ELSE  
  alter table trackingresource add PId bigint identity(1000000,1);

IF COL_LENGTH('TrackingSource', 'PId') IS NOT NULL
  dbcc checkident(TrackingSource,reseed,1000000)
ELSE  
  alter table TrackingSource add PId bigint identity(1000000,1);

IF COL_LENGTH('TrackingSync', 'PId') IS NOT NULL
  dbcc checkident(TrackingSync,reseed,1000000)
ELSE  
  alter table TrackingSync add PId bigint identity(1000000,1);

IF COL_LENGTH('TyroReconciliation', 'PId') IS NOT NULL
  dbcc checkident(TyroReconciliation,reseed,1000000)
ELSE  
  alter table TyroReconciliation add PId bigint identity(1000000,1);

IF COL_LENGTH('TyroReconcilTransaction', 'PId') IS NOT NULL
  dbcc checkident(TyroReconcilTransaction,reseed,1000000)
ELSE  
  alter table TyroReconcilTransaction add PId bigint identity(1000000,1);

IF COL_LENGTH('TyroReport', 'PId') IS NOT NULL
  dbcc checkident(TyroReport,reseed,1000000)
ELSE  
  alter table TyroReport add PId bigint identity(1000000,1);

IF COL_LENGTH('UserGroupTable', 'PId') IS NOT NULL
  dbcc checkident(UserGroupTable,reseed,1000000)
ELSE  
  alter table UserGroupTable add PId bigint identity(1000000,1);

IF COL_LENGTH('Version', 'PId') IS NOT NULL
  dbcc checkident(Version,reseed,1000000)
ELSE  
  alter table Version add PId bigint identity(1000000,1);

IF COL_LENGTH('VIPTable', 'PId') IS NOT NULL
  dbcc checkident(VIPTable,reseed,1000000)
ELSE  
  alter table VIPTable add PId bigint identity(1000000,1);

IF COL_LENGTH('VoidReasonTable', 'PId') IS NOT NULL
  dbcc checkident(VoidReasonTable,reseed,1000000)
ELSE  
  alter table VoidReasonTable add PId bigint identity(1000000,1);

IF COL_LENGTH('WastageHead', 'PId') IS NOT NULL
  dbcc checkident(WastageHead,reseed,1000000)
ELSE  
  alter table WastageHead add PId bigint identity(1000000,1);

IF COL_LENGTH('WastageItem', 'PId') IS NOT NULL
  dbcc checkident(WastageItem,reseed,1000000)
ELSE  
  alter table WastageItem add PId bigint identity(1000000,1);