Ejemplo n.º 1
0
        public virtual void Rename(
            [NotNull] string name,
            [NotNull] string newName,
            [CanBeNull] string type,
            [NotNull] SqlBatchBuilder builder)
        {
            Check.NotEmpty(name, nameof(name));
            Check.NotEmpty(newName, nameof(newName));
            Check.NotNull(builder, nameof(builder));

            builder
            .Append("EXECUTE sp_rename ")
            .Append(_sql.GenerateLiteral(name))
            .Append(", ")
            .Append(_sql.GenerateLiteral(newName));

            if (type != null)
            {
                builder
                .Append(", ")
                .Append(_sql.GenerateLiteral(type));
            }
        }
Ejemplo n.º 2
0
        private void GenerateRename(
            [NotNull] string name,
            [CanBeNull] string schema,
            [NotNull] string newName,
            [NotNull] string objectType,
            [NotNull] SqlBatchBuilder builder)
        {
            builder.Append("EXECUTE sp_rename @objname = N");

            if (!string.IsNullOrWhiteSpace(schema))
            {
                builder
                .Append(_sql.GenerateLiteral(schema))
                .Append(".");
            }

            builder
            .Append(_sql.GenerateLiteral(name))
            .Append(", @newname = N")
            .Append(_sql.GenerateLiteral(newName))
            .Append(", @objtype = N")
            .Append(_sql.GenerateLiteral(objectType))
            .Append(";");
        }