---******************************(6)Alter_Field_Null_to_Null1.sql
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'MaterialDetail')
EXEC sp_rename 'MaterialDetail.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'AnbarColDetail1')
EXEC sp_rename 'AnbarColDetail1.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'AnbarColDetailSymBhr')
EXEC sp_rename 'AnbarColDetailSymBhr.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'MaterialDetail')
EXEC sp_rename 'MaterialDetail.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'MaterialDetailSym')
EXEC sp_rename 'MaterialDetailSym.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'MaterialDetailSymBhr')
EXEC sp_rename 'MaterialDetailSymBhr.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'MaterialDetailSymEng')
EXEC sp_rename 'MaterialDetailSymEng.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'MaterialDetailSymHYazd')
EXEC sp_rename 'MaterialDetailSymHYazd.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'MaterialDetailSymTolid')
EXEC sp_rename 'MaterialDetailSymTolid.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'PazireshKalaDetail')
EXEC sp_rename 'PazireshKalaDetail.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'PostDetail')
EXEC sp_rename 'PostDetail.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'ShellColDetail')
EXEC sp_rename 'ShellColDetail.IsNull', 'IsNull1', 'COLUMN'
Go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectDetail')
EXEC sp_rename 'SubjectDetail.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectDetailRus')
EXEC sp_rename 'SubjectDetailRus.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectDetailSym')
EXEC sp_rename 'SubjectDetailSym.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectDetailSymBhr')
EXEC sp_rename 'SubjectDetailSymBhr.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectDetailSymEng')
EXEC sp_rename 'SubjectDetailSymEng.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectDetailSymTolid')
EXEC sp_rename 'SubjectDetailSymTolid.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectDetailSymTolid')
EXEC sp_rename 'SubjectFDeatil.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectFree2Detail')
EXEC sp_rename 'SubjectFree2Detail.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectFreeDetail')
EXEC sp_rename 'SubjectFreeDetail.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectFreeDetailSym')
EXEC sp_rename 'SubjectFreeDetailSym.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectFreeDetailSymBhr')
EXEC sp_rename 'SubjectFreeDetailSymBhr.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectFreeDetailSymBhr1')
EXEC sp_rename 'SubjectFreeDetailSymBhr1.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectFreeDetailSymHYazd')
EXEC sp_rename 'SubjectFreeDetailSymHYazd.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectFreeDetailSymHyazd2')
EXEC sp_rename 'SubjectFreeDetailSymHyazd2.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'Table1')
EXEC sp_rename 'Table1.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'MaterialDetail')
EXEC sp_rename 'MaterialDetail.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'AnbarColDetail1')
EXEC sp_rename 'AnbarColDetail1.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'AnbarColDetailSymBhr')
EXEC sp_rename 'AnbarColDetailSymBhr.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'VahedDetail')
EXEC sp_rename 'VahedDetail.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'a_AnbarColDetail')
EXEC sp_rename 'a_AnbarColDetail.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'a_MaterialDetail')
EXEC sp_rename 'a_MaterialDetail.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'a_MaterialDetailSym')
EXEC sp_rename 'a_MaterialDetailSym.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'a_jamdarcoldetail')
EXEC sp_rename 'a_jamdarcoldetail.IsNull', 'IsNull1', 'COLUMN'
go
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'anbarcoldetail')
EXEC sp_rename 'anbarcoldetail.IsNull', 'IsNull1', 'COLUMN'
go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'FactorRowDel')
----EXEC sp_rename 'FactorRowDel.order', 'order1', 'COLUMN'
----gO
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'FactorRow')
----EXEC sp_rename 'FactorRow.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'FactorEbtRow')
----EXEC sp_rename 'FactorEbtRow.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'FactorEbtRowold')
----EXEC sp_rename 'FactorEbtRowold.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'FactorRow1')
----EXEC sp_rename 'FactorRow1.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'FactorRowTmp')
----EXEC sp_rename 'FactorRowTmp.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'PazireshRow')
----EXEC sp_rename 'PazireshRow.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'PishFactorRow')
----EXEC sp_rename 'PishFactorRow.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SefareshRow')
----EXEC sp_rename 'SefareshRow.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'ShellColDetail')
----EXEC sp_rename 'ShellColDetail.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'SubjectDetailRus')
----EXEC sp_rename 'SubjectDetailRus.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'a_FactorRow')
----EXEC sp_rename 'a_FactorRow.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'a_MaterialDetail')
----EXEC sp_rename 'a_MaterialDetail.order', 'order1', 'COLUMN'
----go
----if 'order1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'a_MaterialDetailSym')
----EXEC sp_rename 'a_MaterialDetailSym.order', 'order1', 'COLUMN'
go
--select * from a_FactorRow
----***********************************(999)isnull_to_isnull1_rpc.sql
use rpc
if 'IsNull1' Not in(select Column_name from INFORMATION_SCHEMA.COLUMNS WHERE  Table_name = 'Objectrows')
EXEC sp_rename 'Objectrows.IsNull', 'IsNull1', 'COLUMN'
Go
Alter Table objectdoc   Add   tick varchar(200) NULL
Go

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ObjectRowsOrderFast]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[ObjectRowsOrderFast]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AllDocumentsInfo]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[AllDocumentsInfo]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MenuDesignFull]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[MenuDesignFull]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MenuDesignInfo]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[MenuDesignInfo]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MenuDesignObject]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[MenuDesignObject]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MenuDesignOrder]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[MenuDesignOrder]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MenuDesignReOrder]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[MenuDesignReOrder]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MenuFull]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[MenuFull]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MenuProgramOrder]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[MenuProgramOrder]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ObjectDetailInfo]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[ObjectDetailInfo]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ObjectQuery]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[ObjectQuery]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ObjectRowsFull]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[ObjectRowsFull]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ObjectRowsOrder]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[ObjectRowsOrder]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SelectMenu]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[SelectMenu]
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.ObjectRowsOrderFast
AS
SELECT     TOP 100 PERCENT dbo.ObjectRows.*
FROM         dbo.ObjectRows

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.AllDocumentsInfo
AS
SELECT     TOP 100 PERCENT dbo.AllDocuments.*
FROM         dbo.AllDocuments
ORDER BY SanadNum, SaveDate, SaveTime

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.MenuDesignFull
AS
SELECT     dbo.MenuDesign.*, dbo.Objects.Name AS Name
FROM         dbo.MenuDesign LEFT OUTER JOIN
                      dbo.Objects ON dbo.MenuDesign.ObjectID = dbo.Objects.ObjectID
WHERE     (dbo.Objects.Model = 1)

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.MenuDesignInfo
AS
SELECT     dbo.MenuDesign.MenuCaption AS PMenuCaption, dbo.MenuDesignFull.*
FROM         dbo.MenuDesignFull LEFT OUTER JOIN
                      dbo.MenuDesign ON dbo.MenuDesignFull.ParentCode = dbo.MenuDesign.MenuCode

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.MenuDesignObject
AS
SELECT     dbo.MenuDesign.MenuCode, dbo.MenuDesign.MenuType, dbo.MenuDesign.MenuName, dbo.MenuDesign.MenuCaption, 
                      dbo.Objects.Name AS ObjectName, dbo.Objects.Caption AS CaptionName, dbo.MenuDesign.ParentCode, dbo.MenuDesign.ObjectID, 
                      dbo.MenuDesign.ShortCut, dbo.MenuDesign.MenuEvent, dbo.MenuDesign.MenuEventP1, dbo.MenuDesign.MenuEventP2, 
                      dbo.MenuDesign.MenuEventP3, dbo.MenuDesign.Sorting, dbo.MenuDesign.SoftwareId, dbo.MenuDesign.Opt, dbo.MenuDesign.MenuTop
FROM         dbo.MenuDesign LEFT OUTER JOIN
                      dbo.Objects ON dbo.MenuDesign.ObjectID = dbo.Objects.ObjectID

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.MenuDesignOrder
AS
SELECT     TOP 100 PERCENT dbo.MenuDesign.*
FROM         dbo.MenuDesign

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.MenuDesignReOrder
AS
SELECT     TOP 100 PERCENT dbo.MenuDesign.*
FROM         dbo.MenuDesign
ORDER BY MenuOrder DESC

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.MenuFull
AS
SELECT     dbo.MenuDesign.*, dbo.Objects.Name AS FormName
FROM         dbo.MenuDesign INNER JOIN
                      dbo.Objects ON dbo.MenuDesign.ObjectID = dbo.Objects.ObjectID

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.MenuProgramOrder
AS
SELECT     TOP 100 PERCENT *
FROM         dbo.MenuProgram
ORDER BY Sorting, YearName

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.ObjectDetailInfo
AS
SELECT     dbo.ObjectDetail.*, dbo.Objects.Name AS Name, dbo.Objects.Model AS Model, dbo.Objects.Type AS Type, dbo.Objects.DataSet AS DataSet, 
                      dbo.Objects.DataType AS DataType, dbo.Objects.Caption AS Caption, dbo.Objects.Help AS Help, dbo.Objects.DetailBand AS DetailBand, 
                      dbo.Objects.FormName AS FormName, dbo.Objects.MainMenu AS MainMenu
FROM         dbo.Objects INNER JOIN
                      dbo.ObjectDetail ON dbo.Objects.ObjectID = dbo.ObjectDetail.ObjectId

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.ObjectQuery
AS
SELECT     TOP 100 PERCENT dbo.Objects.ObjectID AS Objects_ObjectID, dbo.Objects.Name, dbo.Objects.Model AS Objects_Model, dbo.Objects.Type, 
                      dbo.Objects.Source, dbo.Objects.Width, dbo.Objects.Height, dbo.Objects.DataSet, dbo.ObjectRows.RowCaption, dbo.Objects.Caption, 
                      dbo.Objects.BackColor, dbo.Objects.Orientation, dbo.Objects.IsTemplate, dbo.Objects.InsertRow, dbo.Objects.InsertRowP1, dbo.Objects.InsertRowP2, 
                      dbo.Objects.InsertRowP3, dbo.Objects.LoadEvent, dbo.Objects.LoadEventP1, dbo.Objects.LoadEventP2, dbo.Objects.LoadEventP3, 
                      dbo.Objects.CloseEvent, dbo.Objects.CloseEventP1, dbo.Objects.CloseEventP2, dbo.Objects.CloseEventP3, dbo.Objects.Notes, 
                      dbo.ObjectRows.ObjectRowID, dbo.ObjectRows.ObjectID AS ObjectRows_ObjectID, dbo.ObjectRows.RowName, dbo.ObjectRows.RowType, 
                      dbo.ObjectRows.FieldName, dbo.ObjectRows.ClassName, dbo.ObjectRows.ParentName, dbo.ObjectRows.RowVisible, dbo.ObjectRows.RowWidth, 
                      dbo.ObjectRows.RowHeight, dbo.ObjectRows.RowLeft, dbo.ObjectRows.RowTop, dbo.ObjectRows.FontName, dbo.ObjectRows.FontSize, 
                      dbo.ObjectRows.FontColor, dbo.ObjectRows.FontStyle, dbo.ObjectRows.RowColor, dbo.ObjectRows.LookupTable, dbo.ObjectRows.LookupField, 
                      dbo.ObjectRows.OrderRow, dbo.ObjectRows.Alignment, dbo.ObjectRows.Frame, dbo.ObjectRows.Footer, dbo.ObjectRows.FooterResult, 
                      dbo.ObjectRows.MaxLenght, dbo.ObjectRows.TitleAngle, dbo.ObjectRows.TitleValign, dbo.ObjectRows.ReadOnly, dbo.ObjectRows.DefaultRow, 
                      dbo.ObjectRows.Mahiat, dbo.ObjectRows.Model AS ObjectRows_Model, dbo.ObjectRows.RowNotes, dbo.ObjectRows.OnButton, 
                      dbo.ObjectRows.OnButtonP1, dbo.ObjectRows.OnButtonP2, dbo.ObjectRows.OnButtonP3, dbo.ObjectRows.OnDraw, dbo.ObjectRows.OnDrawP1, 
                      dbo.ObjectRows.OnDrawP2, dbo.ObjectRows.OnDrawP3, dbo.ObjectRows.OnEnter, dbo.ObjectRows.OnEnterP1, dbo.ObjectRows.OnEnterP2, 
                      dbo.ObjectRows.OnEnterP3, dbo.ObjectRows.OnExit, dbo.ObjectRows.OnExitP1, dbo.ObjectRows.OnExitP2, dbo.ObjectRows.OnExitP3, 
                      dbo.Objects.State, dbo.ObjectRows.Pict, dbo.ObjectRows.RowCaptionFilter, dbo.ObjectRows.FilterTop, dbo.ObjectRows.FilterLeft, 
                      dbo.ObjectRows.SetFocusItem, dbo.ObjectRows.MaxLength, dbo.Objects.DetailBand, dbo.ObjectRows.PrintVisible, dbo.ObjectRows.TitleName, 
                      dbo.ObjectRows.HotKey, dbo.Objects.EditRow, dbo.Objects.EditRowP2, dbo.Objects.EditRowP1, dbo.Objects.EditRowP3, dbo.Objects.FormName, 
                      dbo.Objects.MainMenu, dbo.ObjectRows.ShowEmpty, dbo.ObjectRows.TabOrderF, dbo.ObjectRows.TabOrderT, dbo.ObjectRows.LengthA, 
                      dbo.ObjectRows.DefaultCombo, dbo.ObjectRows.Style, dbo.Objects.EMTop, dbo.Objects.EMBot, dbo.Objects.EMLeft, dbo.Objects.EMRight, 
                      dbo.Objects.PrintHeight, dbo.ObjectRows.SetFocusGrid, dbo.ObjectRows.OnClick, dbo.ObjectRows.OnClickP1, dbo.ObjectRows.OnClickP2, 
                      dbo.ObjectRows.OnClickP3, dbo.ObjectRows.OnClickHint, dbo.ObjectRows.DefaultAllowed, dbo.ObjectRows.Shakhes
FROM         dbo.Objects INNER JOIN
                      dbo.ObjectRows ON dbo.Objects.ObjectID = dbo.ObjectRows.ObjectID

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.ObjectRowsFull
AS
SELECT     dbo.Objects.Name, dbo.ObjectRows.*
FROM         dbo.ObjectRows LEFT OUTER JOIN
                      dbo.Objects ON dbo.ObjectRows.ObjectID = dbo.Objects.ObjectID

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.ObjectRowsOrder
AS
SELECT     TOP 100 PERCENT dbo.ObjectRows.*
FROM         dbo.ObjectRows
ORDER BY OrderRow

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

CREATE VIEW dbo.SelectMenu
AS
SELECT     TOP 100 PERCENT *
FROM         dbo.MenuProgram
WHERE     (KindN = 1)
ORDER BY ParentCode, Sorting

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO


