Category: Shortcut


Icon Finder

Searching icon http://www.iconfinder.com/


How to drop column with constraint in sql server

Find the default constraint with this query here:

SELECT
df.name ‘Constraint Name’ ,
t.name ‘Table Name’,
c.NAME ‘Column Name’
FROM sys.default_constraints df
INNER JOIN sys.tables t ON df.parent_object_id = t.object_id
INNER JOIN sys.columns c ON df.parent_object_id = c.object_id AND df.parent_column_id = c.column_id

This gives you the name of the default constraint, as well as the table and column name.

When you have that information you need to first drop the default constraint:

ALTER TABLE dbo.YourTable
DROP CONSTRAINT name-of-the-default-constraint-here

and then you can drop the column

ALTER TABLE dbo.YourTable DROP COLUMN YourColumn

Reference:
http://stackoverflow.com/questions/8641954/how-to-drop-column-with-constraint


Add column, with default value, to existing table in SQL Server

You can find the solution here:

http://stackoverflow.com/questions/92082/add-column-with-default-value-to-existing-table-in-sql-server

ALTER TABLE {TABLENAME}
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL}
CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}


How does one select the TOP N rows from a table in Oracle?

Check the link:

http://www.orafaq.com/faq/how_does_one_select_the_top_n_rows_from_a_table


Content Type application/soap+xml; charset=utf-8 was not supported by service

The remote server returned an error: (415) Cannot process the message because the content type ‘text/xml; charset=utf-8′ was not the expected type ‘application/soap+xml; charset=utf-8′..

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The remote server returned an error: (415) Cannot process the message because the content type ‘text/xml; charset=utf-8′ was not the expected type ‘application/soap+xml; charset=utf-8′..

First Google hit says:

this is usually a mismatch in the client/server bindings, where the message version in the service uses SOAP 1.2 (which expects application/soap+xml) and the version in the client uses SOAP 1.1 (which sends text/xml). WSHttpBinding uses SOAP 1.2, BasicHttpBinding uses SOAP 1.1.

It usually seems to be a wsHttpBinding on one side and a basicHttpBinding on the other.

My Solution:

Change wsHttpBinding to be basicHttpBinding …