sql-server

FluentMigrator & Lock request timeout period exceeded

I am shifting my development platform to a virtual machine (using VirtualBox), and have installed Win7, VS2010 and SQL Server Express 2008 R2. I have a project that uses FluentMigrator to look after the database. When I (try to) run the initial migration, all console messages come back from FluentMigrator reporting success, but when I ...

Why would using a Temp table be faster than a nested query?

We are trying to optimise some of our queries. One query is doing the following: SELECT t.TaskID, t.Name as Task, '' as Tracker, t.ClientID, (<complex subquery>) Date, INTO [#Gadget] FROM task t SELECT TOP 500 TaskID, Task, Tracker, ClientID, dbo.GetClientDisplayName(ClientID) as Client FROM [#Gadget] order by CASE WHEN Date IS NULL...

Authentication Problem in Silverlight - Cannot connect to SQL Server

Hi All, At the moment, when I try to register a user using the default Business Template in Silverlight, I am getting an error. Basically I am following a tutorial found on Channel 9 on how to build a business app with Silverlight. "An error has occurred while establishing a connection to the server. (provider: Named Pipes Provider, ...

UPDATE from SELECT complains about more that one value returned

I have this data structure: request ======= building_id lot_code building ======== building_id lot_id lot === lot_id lot_code The request table is missing the value for the building_id column and I want to fill it in from the other tables. So I've tried this: UPDATE request SET building_id = ( SELECT bu.building_id FROM bui...

Saving multiple items per single database cell...

Hi, i have a countries list. Each user can check multiple countries. Once saved, this "user country list" will be used to get whether other users fit into countries certain user chose. Question is what would be the most efficient approach to this problem... I have one, one to save user selection as delimited list like Canada,USA,Franc...

hash password in SQL Server (asp.net)

Is this how hashed password stored in SQL Server should look like? This is function I use to hash password (I found it in some tutorial) public string EncryptPassword(string password) { //we use codepage 1252 because that is what sql server uses byte[] pwdBytes = Encoding.GetEncoding(1252).GetBytes(password); byte[] hashB...

Linq to SQL - what's better?

db.Albums.FirstOrDefault(x => x.OrderId == orderId) or db.Albums.FirstOrDefault(x => x.OrderId.Equals(orderId)) ...

stored procedure for importing txt in sql server db

I have to insert new records in a database every day from a text file ( tab delimited). I'm trying to make this into a stored procedure with a parameter for the file to read data from. CREATE PROCEDURE dbo.UpdateTable @FilePath BULK INSERT TMP_UPTable FROM @FilePath WITH ( FIRSTROW = 2, MAXERROR...

In SQL Server 2008 ,is it possible to disable auto drop of global temp table

Hi question1 : I am using global temp tables in SQL Server 2008 but once my connection is closed this temp is dropped is there any way to disable auto drop Question2 : If two connections are accesstion same global temp table and another connection is trying to delete that global temp table, does SQL Server handles this synchroni...

tsql source control using msscci

Hi All, I have the TFS MSSCCI installed, now what? How do I use it to put say like a stored procedure under source control? Thanks, rodchar ...

SQL Server, Select CASE with different casting

I want to do a select that do a cast only for a specific ID but it doesn't seems to work. Example : SELECT CASE WHEN(@ID <> 1) THEN Code WHEN(@ID = 1) THEN Cast(Code AS int) END Code FROM .... Any Idea ? ...

SSIS DTSX File Repair Tool

I'm working with an SSIS 2005 file that crashes Visual Studio 2005 on my workstation. This happens when I open the data flow diagram and Visual Studio attempts to validate the package. I can open it successfully on another computer though. The package itself is fairly simple and only has two control flow tasks and maybe ten tasks in t...

insert data into several tables

Let us say I have a table (everything is very much simplified): create table OriginalData ( ItemName NVARCHAR(255) not null ) And I would like to insert its data (set based!) into two tables which model inheritance create table Statements ( Id int IDENTITY NOT NULL, ProposalDateTime DATETIME null ) create table Items...

Update rows by separating values from one column and inserting into 2 diff. columns

For eg. I have table T1. There are 4 columns in it c1 c2 c3 and c4. I have c1 as id, c2 contains combine name and address. c3 and c4 are empty. There are multiple rows for given id. Let's say there are 10 rows for id=10. What I want is for all the rows with id=10, I want to read c2, separate values in c2 as name and address and store n...

Reporting Services - SQL query takes 10 times as long, 100% cpu, when in a stored procedure vs inline SQL

I have a SQL query - fairly complex, but not too bad. When I run the SQL query in Management Studio, the query runs in about 10 seconds or less. When I put the SQL query directly into a reporting services report, the query runs in about 10 seconds or less. When I put the exact same SQL query into a stored procedure, and cal...

Stored procedures vs. parameter binding

I am using SQL server and ODBC in visual c++ for writing to the database. Currently i am using parameter binding in SQL queries ( as i fill the database with only 5 - 6 queries and same is true for retrieving data). I dont know much about stored procedures and I am wondering how much if any performance increase stored procedures have ove...

Is it possible to mirror SQL Server 2008 and SQL Server 2008R2 databases?

Just curious whether it's possible to mirror databases across versions. ...

What is the Null Character literal in TSQL?

I am wondering what the literal for a Null character (e.g. '\0') is in TSQL. Note: not a NULL field value, but the null character (see link). I have a column with a mix of typical and a null character. I'm trying to replace the null character with a different value. I would have thought that the following would work but it is unsucce...

Accessing SQL Server Cluster from ASP.Net

Hi there, fellows. I'm a total unix-way guy, but now our company creates a new application under ASP.NET + SQL Server cluster platform. So I know the best and most efficient principles and ways to scale the load, but I wanna know the MS background of horizontal scaling. The question is pretty simple – are there any built-in abilities...

SQL help - find the table that has 'somefieldId' as the primary key?

Hello All, How can I search my sql database for a table that contains a field 'tiEntityId'. This field is referenced in a stored procedure, but I am unable to identify which table this id is a primary key for? Any suggestions? I currently look through stored procedure definitions for references to text by using something like this Decla...