sql-server

What does SQL Server trace flag 253 do?

In another question I was trying to research how to control SQL Server's query plan caches: http://stackoverflow.com/questions/2593749/is-there-an-equivalent-of-optionrecompile-or-with-recompile-for-an-entire-c ...and I found trace flag 253 via this article: http://www.sqlservercentral.com/Forums/Topic837613-146-1.aspx The article is...

Procedure or function expects parameter which was not supplied

Driving me mad on a personal project; I know I've done this before but elsewhere and don't have the code. As far as I can see, I'm setting the parameter, I'm setting its value, the connection is open, yet when I try to fill the dataset I get the error 'Procedure or function expects parameter "@test" which was not supplied'. (This is o...

Database migrations for SQL Server

I need a database migration framework for SQL Server, capable of managing both schema changes and data migrations. I guess I am looking for something similar to django's South framework here. Given the fact that South is tightly coupled with django's ORM, and the fact that there's so many ORMs for SQL Server I guess having just a gener...

SQL Server version of MySQL's group_concat and escaped strings

I only have the Express versions of MS SQL Server 2008 and Visual Studio. Given that I can't create a SQL Server project and therefore CLR solutions are out of the question, I've attempted to use select col1, stuff( ( select ' ' + col2 from StrConcat t1 where t2.col1 = t1.col1 for xml path('') ),1,1,'') from StrConcat t2 group by col1 ...

Returning the value of an identity column during/after SQL INSERT command

Using VS 2010, with ASP.NET, and .NET 3.0, and C#... When I use a System.Web.UI.WebControls.SqlDataSource and call its Insert() method to insert a new row, and that table has an identity column, I'd like my method to return the value of that column. For example, in my SQL 2005 table, I've got: Customer.Id Customer.FirstName Customer...

Comma-separated value insertion In SQL Server 2005

How can I insert values from a comma-separated input parameter with a stored procedure? For example: exec StoredProcedure Name 17,'127,204,110,198',7,'162,170,163,170' you can see that I have two comma-separated value lists in the parameter list. Both will have the same number of values: if the first has 5 comma-separated values, then...

Value cannot be null.Parameter name: key when databind in ASP.NET

Hi all I am triing to bind the data to a listbox from sql server then got the error "Value cannot be null.Parameter name: key" ddlCountry = new Obout.ComboBox.ComboBox(); ddlCountry.Width = 200; ddlCountry.Height = 200; ddlCountry.DataTextField = "Country"; ddlCountry.DataValueField = "Country"; sqlCommand = "SELECT [Country] FROM [tbl...

SQL Get UID when Group by

I do a select from table [V_RPT_BelegungKostenstelleDetail] WHERE SO_UID = '7C7035C8-56DD-4A44-93CC-F16FD66280A3' AND GB_UID = '4FF1B0EE-A5DD-4699-94B7-760922666CE2' AND GS_UID = '1188759A-54E1-4323-8BF2-85E71B3C796E' AND RM_UID = '088C3559-6E6E-468A-9554-6740840FCBA1' AND NA_UID= '96A2A8DB-8C83-4C60-9060-F0F55719AF5C' GROUP BY KST_UI...

SQL Server "not known to be running"

When I attempt to connect to SQL server using enterprise manager I get the strange message: "SQL Server is not known to be running. Are you sure you want to connect?" What is it trying to tell me? Is there some special caution required in trying to connect to a server that is not known to be running? If so, how do I find out if a serv...

Licenses required for an asp.net web server

What are the licences required for an asp.net (MVC) web application using sql server running a windows server ? Is Windows Web Server 2008 R2 enough for running SQL Server 2008 Web ? Is it possible (legal ?!) to install SQL Server on a "Web" operating system ? What are the limitations ? An official link would be nice ...

Concurrent usage of table causing issues

Hello In our current project we are interfacing with a third party data provider. They need to insert data in a table of ours. This inserting can be frequent every 1 min, every 5min, every 30, depends on the amount of new data they need to provide. The use the isolation level read committed. On our end we have an application, windows s...

SQL Server full text search catalog not full updated

It seems that my Sql Server Full text catalog is not always up to date. I regularly run the script: EXEC sp_fulltext_catalog 'HtmlSearch', 'start_full' After that my catalog is up to date and my search results are fine. Is there somewhere an option that I have to set? And when does the full text update itself? ...

Updating nullability of columns in SQL 2008

I have a very wide table, containing lots and lots of bit fields. These bit fields were originally set up as nullable. Now we've just made a decision that it doesn't make sense to have them nullable; the value is either Yes or No, default No. In other words, the schema should change from: create table MyTable( ID bigint not null, ...

SQL Server 2005 Full text search - Searching for numbers

Hi all, I using the SQL Server 2008 FTS feature in a project. When searching for a phone number like CONTAINSTABLE(table, *, '"017394708699"'), this query also returns records containing the number '017394689966', which is similar. Does anyone know how I can get an exact match from a number? ...

Excluding records based upon a one to many SQL join

How would I write a SQL query that excludes a record if one (external) record from a one to many join matches a certain condition? For example: Details ID 1 2 Items DetailID Item 1 A 1 B 2 B 2 C How would I select the detail records where the Items do not include 'A'...

Pretty Printer for T-SQL?

I'm looking for a good T-SQL Pretty Printer so that all the code looks consistent between developers in our project. Preferably a free/open source one, but paid for isn't out of the realms of possibility as long as it's reasonably priced. Are there any particular industry leaders? I'm not that fussed about what particular standard it ...

A column insert or update conflicts with a rule imposed by a previous CREATE RULE statement.

I'm working on a online game. I got some problems with inserting new data to table. I'm getting 2010-4-8 2:14, 37000, 513, [Microsoft][ODBC SQL Server Driver][SQL Server]A column insert or update conflicts with a rule imposed by a previous CREATE RULE statement. The statement was terminated. The conflict occurred in data...

What do these .NET auto-generated table adapter commands do? e.g. UPDATE/INSERT followed by a SELECT

I'm working with a legacy application which I'm trying to change so that it can work with SQL CE, whilst it was originally written against SQL Server. The problem I am getting now is that when I try to do dataAdapter.Update, SQL CE complains that it is not expecting the SELECT keyword in the command text. I believe this is because SQL ...

SQLServer triggers

Please help me to write trigger that, adds new rows in table I have 3 tables in my database. Regions (id, name); id - primary Technics (id, name); id - primary Availability (id, region, technic, count); id - primary, region - foreign on Regions.id, Technik - foreign on technics.id I want to add new row in Availability for each Tech...

Is it possible to get feedback on duplicates with SqlBulkCopy

I'm using SqlBulkCopy to insert into a table with IGNORE_DUP_KEY on. This means that exceptions aren't thrown when duplicate is encountered, instead it passes over it and continues. Is it possible to get feedback on which rows were inserted or ignored? ...