ddl

Why is my alter table statement not properly adding a column to my temporary table?

≯℡__Kan透↙ 提交于 2019-12-12 01:59:52
问题 I have a temporary table created at the beginning of this stored procedure. It is created successfully and can be selected from and inserted to. Here is the create statement CREATE TABLE #tmpImportData (GuideFirstName VARCHAR(MAX), GuideLastName VARCHAR(MAX), email VARCHAR(MAX), group_id_text VARCHAR(MAX), CandidateName VARCHAR(MAX), grade_text VARCHAR(5), dateofbirth DATE ) My problem is trying to update a column after I alter the temporary table. I get the error Msg 207, Level 16, State 1

ADO.NET and ExecuteNonQuery: how to use DDL

﹥>﹥吖頭↗ 提交于 2019-12-12 01:18:31
问题 I execute SQL scripts to change the database schema. It looks something like this: using (var command = connection.CreateCommand()) { command.CommandText = script; command.ExecuteNonQuery(); } Additionally, the commands are executed within a transaction. The scrip looks like this: Alter Table [TableName] ADD [NewColumn] bigint NULL Update [TableName] SET [NewColumn] = (SELECT somevalue FROM anothertable) I get an error, because NewColumn does not exist. It seems to parse and validate it

Oracle after update trigger creating public database link

梦想的初衷 提交于 2019-12-11 19:03:50
问题 I have an error: 'ORA-04092: cannot COMMIT in a trigger' when trying to execute ddl command in one simple oracle after update trigger. Trigger needs to create public database link after one field in column is updated. Here is the source: create or replace TRIGGER CreateLinkTrigger after UPDATE of Year ON tableInit for each row DECLARE add_link VARCHAR2(200); BEGIN IF :new.year = '2014' then add_link := q'{create public database link p2014 connect to test14 identified by temp using 'ora'}';

SQL Server CE's DDL parser is very picky but secretive about what it is finding fault with

谁都会走 提交于 2019-12-11 18:54:52
问题 I keep getting "there was an error parsing the query" no matter what I try with my DDL. So I need an expert in the SQL-Server-CE flavor of SQL to tell me which of the following is the preferred method (or something else, quite likely). Note that I'm not worried about "SQL injection" with these string format elements: 1) string ddl = string.Format("ALTER TABLE {0} ADD salvationID nvarchar(19)", tablename); ddl = string.Format("UPDATE {0} SET redemptionID = ''", tablename); 2) string ddl =

How can one view the create table DDL for a bigquery table?

风格不统一 提交于 2019-12-11 17:54:53
问题 I'm trying to use the Web UI to extract a create table statement, so that I can see how one might create a nullable repeated column (if possible). I've managed to make something like that using a query is some context. It created a record column with a mode repeated, which within it had a record column with a mode of nullable. Not sure if that's necessary, and, in any event, I'd like to see how one would go about doing that. 回答1: how one might create a nullable repeated column (if possible)?

How to write DB2 DDL & DML audit logs as System Application Logs?

家住魔仙堡 提交于 2019-12-11 15:10:00
问题 I am using DB2 LUW in a windows machine. I want to get the logs for DDL & DML queries used in the database. The default logs(for example S000001.LOG) contains 'null' and not in a readable format. So I enabled auditing and extracted the archived audit logs into .del files. But the audit log extraction creates .del like this: execute.del "2019-09-05-01.19.44.443001","EXECUTE","STATEMENT",13,0,"TEST2","Administrator","ADMINISTRATOR","ADMINISTRATOR",,,"*LOCAL.DB2.190904193137","db2bp.exe",,,,,,,,

DB sketcher for MacOS?

浪尽此生 提交于 2019-12-11 12:05:55
问题 I've been trying to find a free database creator for mac os, and i'm not being able to find any. Anyone know of a free one i could download? EDIT: I need that the application generate the sql (mysql in this case) also :) ty 回答1: SQL Designer is web-based. There's also more options at this question. 回答2: I think the Entity modeling stuff in XCode might be of us to you... 回答3: SchemaBank is another web-based one available. 来源: https://stackoverflow.com/questions/233636/db-sketcher-for-macos

Force Truncation on VARCHAR modification?

℡╲_俬逩灬. 提交于 2019-12-11 11:54:13
问题 I would like to cap VARCHAR to 255 on a few columns so that I can add an index. alter table striker modify contacts varchar(255) When I try to run the above command I get Error Code: 1265. Data truncated for column 'contacts' at row 331 38.969 sec Is there a way to force truncation of the column so that this command successfully shortens the VARCHAR? I don't care about shortening the data in the column. 回答1: You can manually truncate the column at 255 characters: UPDATE striker SET contacts =

referencing part of the composite primary key

余生颓废 提交于 2019-12-11 11:07:46
问题 I have problems with setting the reference on database table. I have following structure: CREATE TABLE club( id INTEGER NOT NULL, name_short VARCHAR(30), name_full VARCHAR(70) NOT NULL ); CREATE UNIQUE INDEX club_uix ON club(id); ALTER TABLE club ADD CONSTRAINT club_pk PRIMARY KEY (id); CREATE TABLE team( id INTEGER NOT NULL, club_id INTEGER NOT NULL, team_name VARCHAR(30) ); CREATE UNIQUE INDEX team_uix ON team(id, club_id); ALTER TABLE team ADD CONSTRAINT team_pk PRIMARY KEY (id, club_id);

Tools to generate SQL DDL and Content from an existing database

风格不统一 提交于 2019-12-11 08:36:52
问题 Does anyone know of a reasonably priced tool that will create DDL statements to create a SQL Server database and appropriate Insert statements to recreate the data? I use the Red Gate tools to do database compares (including content compares) and this comes close (I could always compare with an empty schema) but I was wondering if there was a tool that others found useful that did this in one step. 回答1: Have you had a look at SQL Publishing Wizard? It will create all the DDL statements you