If not exists (select * From DBO. sysobjects where id = object_id (N 'print _ billformat') and objectproperty (ID, N 'isusertable') = 1)
Begin
/* Print _ User format */
Create Table print_billformat
(Billid varchar (50) not null,
Printformat text null,
Formatid varchar (100) not null,
Orgid varchar (50)
)
End
/* Print _ premade format */
If not exists (select * From DBO. sysobjects where id = object_id (N 'print _ Bill') and objectproperty (ID, N 'isusertable') = 1)
Begin
Create Table print_bill
(Billmkid varchar (4) not null,/* module ID of the document */
Billid varchar (50) primary key not null,/* logical document name */
Billname varchar (50) not null,/* Document display name */
Recordspath varchar (200) null,
Paramcount int default 0/* Number of parameters in the generated XML */
)
End
Else
Begin
/* = */
/* Modify the table structure of print_bill */
/* = */
If not exists (select * From DBO. syscolumns where name = 'billkid' and ID = object_id ('print _ Bill '))
Begin
Alter table print_bill add billmkid varchar (4) default ''not null
End
Exec sp_rename 'print _ Bill ', 'print _ billtemp'
Create Table print_bill
(
Billmkid varchar (4) not null,/* module ID of the document */
Billid varchar (50) primary key not null,/* logical document name */
Billname varchar (50) not null,/* Document display name */
Recordspath varchar (200) null,
Paramcount int default 0,/* Number of parameters in the generated XML */
)
Insert into print_bill (billmkid, billid, billname, recordspath, paramcount)
Select billmkid, billid, billname, recordspath, paramcount
From print_billtemp
Drop table print_billtemp
End