Script() public method

public Script ( ) : string
return string
Example #1
0
        public override string ScriptCreate()
        {
            var text = new StringBuilder();

            text.Append(HeaderScriptCreate(Owner));

            text.AppendLine($"CREATE {(IsType ? "TYPE" : "TABLE")} [{Owner}].[{Name}] {(IsType ? "AS TABLE " : string.Empty)}(\r\n");
            text.Append(Columns.Script());
            if (_constraints.Count > 0)
            {
                text.AppendLine();
            }
            foreach (var c in _constraints.OrderBy(x => x.Name).Where(c => c.Type != "INDEX"))
            {
                text.AppendLine("   ," + c.ScriptCreate());
            }
            text.Append(")");
            if (PartitionSQL != null)
            {
                text.AppendLine($" ON {PartitionSQL}");
            }

            text.AppendLine();
            text.Append(ExtendedProperties.Script());
            text.AppendLine();

            foreach (var c in _constraints.Where(c => c.Type == "INDEX"))
            {
                text.AppendLine(c.ScriptCreate());
                text.AppendLine();
            }
            return(text.ToString());
        }
Example #2
0
        public string ScriptCreate()
        {
            var text = new StringBuilder();

            text.Append(
                $"CREATE {(IsType ? "TYPE" : "TABLE")} [{Owner}].[{Name}] {(IsType ? "AS TABLE " : string.Empty)}(\r\n");
            text.Append(Columns.Script());
            if (_constraints.Count > 0)
            {
                text.AppendLine();
            }
            foreach (var c in _constraints.OrderBy(x => x.Name).Where(c => c.Type != "INDEX"))
            {
                text.AppendLine("   ," + c.ScriptCreate());
            }

            text.AppendLine(")");
            text.AppendLine();
            foreach (var c in _constraints.Where(c => c.Type == "INDEX"))
            {
                text.AppendLine(c.ScriptCreate());
            }

            return(text.ToString());
        }
Example #3
0
        public string ScriptCreate()
        {
            var text = new StringBuilder();

            text.AppendFormat("CREATE {2} [{0}].[{1}] {3}(\r\n", Owner, Name, IsType ? "TYPE" : "TABLE",
                              IsType ? "AS TABLE " : string.Empty);
            text.Append(Columns.Script());
            if (_Constraints.Count > 0)
            {
                text.AppendLine();
            }
            foreach (var c in _Constraints.OrderBy(x => x.Name).Where(c => c.Type != "INDEX"))
            {
                text.AppendLine("   ," + c.ScriptCreate());
            }
            text.AppendLine(")");
            text.AppendLine();
            foreach (var c in _Constraints.Where(c => c.Type == "INDEX"))
            {
                text.AppendLine(c.ScriptCreate());
            }
            return(text.ToString());
        }