示例#1
0
        private void CheckTables(string _schema)
        {
            Select S = new Select(string.Format("select count(*) as nn from INFORMATION_SCHEMA.TABLES where table_type='BASE TABLE' and TABLE_SCHEMA='{0}' and table_name='{1}'", _schema, table_name));

            if (!S.Read())
            {
                FN.fatal("SerialTreeSQL.CheckTables: " + S.SQL + " - не нашли записей");
            }
            int nn = (int)S[0];

            S.Dispose();
            if (nn != 1)
            {
                new ExecSQL(string.Format(
                                " CREATE TABLE {0}(" +
                                "	Unit [varchar](50) NOT NULL,"+
                                "	Val [varchar](max) NULL,"+
                                " CONSTRAINT PK_{1} PRIMARY KEY CLUSTERED" +
                                " (" +
                                "	Unit ASC"+
                                " )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]" +
                                " ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]", _schema + "." + table_name, table_name));
            }
        }