alter

Altering a trigger in Sql Server 2005

I need to alter a trigger in sql server 2005 and I want to do it using a table adapter and a sql statement, not a stored proc. I know I could run this in the query browser and execute it but I need to deploy it across several databases and use a table adapter in the update. Is this possible? Doing Add Query -> Update -> pasting the belo...

Insert default values in a column (access db)

How can I do for inserting a Default Value into a column of a table in Access? I use this instruction: ALTER TABLE Tabella ADD Campo Double DEFAULT 0 ALTER TABLE Tabella ADD Campo Double DEFAULT (0) ALTER TABLE Tabella ADD Campo DEFAULT 0 ALTER TABLE Tabella ADD Campo DEFAULT (0) ALTER TABLE Tabella ADD Campo SET DEFAULT 0 ALTER TABLE T...

Add a field in ACCESS with a default value

I'd like to insert a new field with a Default value using Visual C++ Code. I have wrote this: CADODatabase pDB; String strConnessione = _T("Provider=Microsoft.Jet.OLEDB.4.0;""Data Source="); strConnessione = strConnessione + "MioDatabase.mdb"; pDB.SetConnectionString(strConnessione); pDB.Open(); query.Format("ALTER TABLE TBProva ADD Fa...

Code in Visual C++ for adding a field to a table with default value

I'd like to insert a new field with a Default value using Visual C++ Code. I have wrote this, but it doesn't function as I want: CADODatabase pDB; String strConnessione = _T("Provider=Microsoft.Jet.OLEDB.4.0;""Data Source="); strConnessione = strConnessione + "MyDatabase.mdb"; pDB.SetConnectionString(strConnessione); pDB.Open(); qu...

SQL - Informix - Changing the datatype of a column from numeric to character.

I have a temp table that has numeric integer values in one column. I want to either replace the integer values with character values based on some criteria or I want to add another column of character type that automatically inserts values into itself based on some criteria. If x <= 1, change to "SP" or make new column and store "SP" i...

What is the equivalent of 'CREATE TABLE ... LIKE ..." in MSSQL

I am working with MSSQL (I am a MSSQL noob) and trying to alter a table. I want to CREATE TABLE LIKE to safely store data while I drop keys and constraints and all the other rigamorole that MSSQL seems to require when altering on the original table but I have not been able to find a match to that command... ...

How do you assign a column default in MySQL to another column's value?

I want to add a new column to a table in MySQL database that should get the value of another column in the same table. Is this possible? If so, how do you do it? Thanks! ...

How do I disable a full-Text Search on a column in sql server?

I'm trying to convert a column from ntext to nvarchar(MAX), but it seems there is a Full-Text search enabled on it. Alter table <table> alter column <column> nvarchar Then i'm going to force the text into rows update <table> set <column> = <column> +'' where <column> is not null Finally I'll need to enable the full text search...

SQL Server ALTER field NOT NULL takes forever

I want to alter a field from a table which has about 4 million records. I ensured that all of this fields values are NOT NULL and want to ALTER this field to NOT NULL ALTER TABLE dbo.MyTable ALTER COLUMN myColumn int NOT NULL ... seems to take forever to do this update. Any ways to speed it up or am I stuck just doing it overnight dur...

How can I have a column in a MySQL database be a function of other columns?

I'm working with a database that keeps track of where a reader is in a book. I do this by having a page count column and a current page column. Is there a way to add a 'progress' column that would be equal to (currentpage/pagecount)? ...

Alter developer username iSQL plus.

How would you go about altering the developer username in iSQL plus. For example I have the current username: developer and want to change it to ccc123_developer ...

MySQL ALTER TABLE on very large table - is it safe to run it?

I have a MySQL database with one particular MyISAM table of above 4 million rows. I update this table about once a week with about 2000 new rows. After updating, I then perform the following statement: ALTER TABLE x ORDER BY PK DESC i.e. I order the table in question by the primary key field in descending order. This has not given me a...

How to write sql to set alter a column's default value in sql server 2005?

I have a table [Product] with a column [CreateTime] datetime null, and is has some data already. How can I set the column [CreateTime] 's default value to getdate(), and make the new added data to have a default value getdate() for column [CreateTime]. ...

SQL Server script: ALTER PROCEDURE - Executing multiple ALTER PROCEDURE into one script without having to select each of the ALTER one after another

I know this is not a big issue, but it tickles me anyway. I have a SQL Server 2005 script to create new data tables, constraints, altering some tables to add columns, altering procedures to take the table changes into account, etc. Everything runs fine until the script encounters my ALTER PROCEDURE statements. The error message is as f...

Drupal - Set default value in hook_form_alter?

Trying to prepopulate some of my form fields, and am using hook_form_alter(). I've tried a couple of different ways, but in both cases, the fields still come up empty. I'm assuming that I need to set default_value and not value because if the user changes what's in the field, I want that to update correctly. Is that right? Here's wha...

How do I alter a mysql table column defaults?

I have a table with a column of type timestamp which defaults current_timestamp and updates to current_timestamp on every update. I want to remove the "on update" feature on this column. How do I write the alter statement? I tried the following: ALTER TABLE mytable alter column time set DEFAULT now(); but this didn't work. than...

How can I alter a smalldatetime column with a default to be datetime?

I have a number of columns in my database that were originally created as smalldatetime and that really need to be datetime. Many of these columns were created with the DDL: [columnname] smalldatetime not null default getdate() ...which means that in order to alter the column's type, I first have to drop the default, and then re-crea...

Postgresql - Using subqueries with alter sequence expressions

My question is kind of simple. Is it possible to use subqueries within alter expressions in PostgreSQL? I want to alter a sequence value based on a primary key column value. I tried using the following expression, but it wouldn't execute. alter sequence public.sequenceX restart with (select max(table_id)+1 from table) Thanks in ...

How to use JQuery ajaxForm with nicEdit?

I am using ajaxForm function to submit my form that has nicEdit html editor as well but when I tried to submit the form for the first time the content of the nicEdit is not included... Is there a way that I can intercept the data submitted so I can edit the form data? or maybe add values to the form-data before it actually gets submitted...

Drupal: Add onchange code to option_widgets in form_alter?

Do anyone know how I can add the following to form_alter? Currently I've got two integer cck fields which are populated from sql using the php values command. One field is for make, and the other is for model. Both makes and models are their own node types. Model has a node reference to make. What I want to do on the Make drop down (CC...