|
For each table in my MySQL database I have a mytablename.sql file which contains the CREATE TABLE statement for that table.
I want to add a test to check that noone has added/altered a column in the live database without updating this file - that it, ...
Started by therefromhere on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
SHOW CREATE TABLE works, or just SELECT * FROM x LIMIT 1 be to use the information_schema system....
(The -Bs suppresses some a list of columns per each table to check.
Pared and sorted SHOW output on a temp table made by your .sql file.
|
|
How to Set a existing column of MS SQL table as NOT NULL?
Started by Vinodtiru on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
ALTER TABLE tablename ALTER COLUMN columnname datatype NOT NULL
You will obviously have to make.
|
|
Hi All,
I have two existing tables, with different fields, except for Primary ID (a varchar, not an int). I want to create a third table which is essentially a merge of these two, such that for a given Primary Key I have all fields in one table.
What'...
Started by Richard on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
If you go with the....
CREATE TABLE result AS (SELECT first.*, second.f1, second.f2, second.f3 FROM first INNER JOIN second ON first.id = second.id);
To get a view, do the same except replace "TABLE" with "VIEW".
Similar for a VIEW as well.
|
Ask your Facebook Friends
|
I already have a table which consists of data. I need to alter table to add two new columns which are not null. How can i do that without loosing any existing data?
NOTE: The new columns are not null fields.
Started by sanjeev40084 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Alter ....
Alter table table_name add column_name datetime not null constraint DF_Default_Object_Name default (getdate())
or this one for a varchar field.
You just set a default value in the new columns and that will allow you to add them .
|
|
Using tsql, sqlserver 2005.
I would like insert records from table table2 into an existing table table1 as easily as I could enter it into a new table table1 using:
select facilabbr, unitname, sortnum into table1 from table2
Any ideas?
Started by Lill Lansey on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Assuming you just want to append and that the columns match up:
INSERT INTO Table1 SELECT facilabbr, unitname, sortnum FROM table2
If you want to replace and the columns still match:
Truncate Table1 INSERT INTO Table1 SELECT facilabbr, unitname, sortnum... .
|
|
I have a SQL Express 2008 DB that has gone live. I'd like to create a new table in that database without deleting all the existing data in the live DB. I created an entity class for the new table and a separate data-context.
What is the best way for me...
Started by Redshirt on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
?
Why you add unmapped to Entity which shipped with Visual Studio 2010 there is easy way to create Database table from Model.
Why not just execute the SQL statement, like create table [mytable] ...
|
|
I need to add a table using iTextSharp (or even PDFSharp if it can do it) into an existing PDF template at a particular location in the template. I can edit the existing template with Adobe Designer 7.0. How can I go about doing this? Is there a PlaceHolder...
Started by KeithA on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
One caveat is there is no flow, the document will not adjust itself .
There, a table in my case.
|
|
Hi,
We are designing a windows application where we need to 'Get table and column names from existing sql server snapshot file or backup file' .
Does anybody know how it can be done. Please provide help.
Thank you.
Started by team-ferrari22 on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Can you just restore the backup programmatically, then check like you normally would ( information_schema , etc)?
If not, all I can suggest is to look at http://www.idera.com/Products/SQL-toolbox/SQL-virtual-database/
Backup file: no Snapshot: it's just... .
|
|
I want to implement Table Per Type inheritance with Entity framework for an existing database.
The database:
The inheritance for ImageParagraphs works perfect, but I am not able to make a Table Per Type inheritance with LinkListParagraph because of the...
Started by chbu on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
The main problem comes from the unnecessary default key creations by the entity framework .
Of the table.
|
|
Hi,
I want to declare a cursor on a table that does not exist. Of course, my procedure doesnt compile.
This table is a temporary table, and is created by a pre process. It will exist on runtime, but at compile time its another story.
For my select / updates...
Started by Tom on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You should be able to define your cursor like this:
DECLARE c SYS_REFCURSOR; BEGIN OPEN c FOR 'SELECT * FROM dual'; CLOSE c; END;
You can also bind arguments:
OPEN c FOR 'SELECT * FROM dual WHERE DUMMY = :1' USING 'X';
For further information see the ... .
|