sql-server

How optimize queries with fully qualified names in t-sql?

When I call: select * from Database.dbo.Table where NAME = 'cat' It takes: 200 ms And when I change database to Database in Management Studio and call it without fully qualified name it's much faster: select * from Table where NAME = 'cat' It takes: 17 ms Is there any way to make fully qualified queries faster without changing ...

Classic ASP Site Throwing Date Conversion Error After Moving Servers?

I am moving an old store from a Win2003 IIS6 server to a Win2008 IIS7 server, moved everything across including database. The front end seems to work just fine, but when I login it has to do pull in data based on date ranges and now from no where I am getting this error? The conversion of a varchar data type to a datetime data type resu...

SSIS - Multiple Configurations

I have inherited a SSIS project. I have never worked with SSIS before, and the one thing that seems strange to me, is that there is no way to manage multiple configurations. For each SSIS package we have 3 delpoyment environments, DEV, UAT and PRODUCTION. At the moment I am having to edit the configuration for every package we deploy m...

Is there any SQL Server database designer software like MySQL workbench?

I need to design database for SQL Server, is there any MySQL workbench like software for that? I have access to MSDN, so it can also be commercial product that can be found form MSDN. ...

Do I need to translate (local) in a sql server connection string?

When connecting to sql server, I have the hardcoded string "(local)". Is this a string I need to make available for localisation? ie, does (local) always work no matter the current language settings? ...

Make these 2 sql statements into one with the same functionality

I have sql statement one; select linkscat.id, linkscat.category from linkscat, contentlinks, links where contentlinks.linksid = links.id and contentlinks.contentid = @contentid and links.linkscatid = linkscat.id order by linkscat.category and sql statement 2 takes a parameter called @linkscat which is 'id' from the statement ...

SQL Server 2005: Subquery in EXEC ?

EXEC [dbo].[pr_cfgAddFact] @SettingName = 'TransferBatch', @RoleFK = SELECT TOP 1 rolepk FROM cfgRole WHERE cfgRole.Name = 'SuperAdmin' Why would SQL complain about the SELECT clause here? I am trying to run the proc with the sub query getting the data. ...

How can I know which stored procedure is running in SQL Server 2005

How can I know which stored procedure is running in SQL Server 2005. And also how to print that SP in the query? ...

SQL Performance Question (no where clause vs where column like '%')

Hi, in a query, is there any performance hit by doing a where clause like so select bunchofstuff from sometable where column like '%' vs select bunchofstuff from sometable Building some dynamic queries, just curious. Thanks. ...

Isolation level and DIRT READ SQL SERVER 2005 (advanced question)

Hi all! I will describe my problem for an easier explanation: I have a table and my soft is accessing it (update, insert) using transaction. The problem is that I want to enable DIRT READ in this table. But I cant use with (nolock) in my sql statements because I cant change the soft source. So I was thinking in enable dirty read in th...

Creating Membership Tables, SPROCs, Views in Attached DB

I have AdventureWorks database mdf file in my VS 2010 project. Is there anyway I can create Membership tables inside my AdventureWorks database. I know I can detach the database attach in SQL SERVER 2008. Create the tables and then detach. But I don't have SQL SERVER 2008 and I want to see if this can be done using command line tool. I...

Permissions for Large Variables to Be Sent Via Stored Procedures (SQL Server)

I can't figure out a way to allow more than 4000 bytes to be received at once via a call to a stored procedure. I am storing images in the table that are around 15 - 20 kilobytes each, but upon getting them and displaying them to the page, they are always exactly 3.91 KB in size (or 4000 bytes). Do stored procedures have a limit on how ...

LINQ to SQL get grouped MIN with JOIN

I'm having trouble with a LINQ to SQL query getting the min value using Visual Basic. Here's the SQL: SELECT RC.AssetID, MIN(RC.RecCode) AS RecCode, JA.EngineerNote from JobAssetRecCode RC JOIN JobAssets JA ON JA.AssetID = RC.AssetID AND JA.JobID = RC.JobID WHERE RC.InspState = 2 AND RC.RecCode > 0 AND RC.JobID = @JobID GROUP BY RC.Asse...

How to get use text columns in a trigger

I am trying to use an update trigger in sql 2000 so that when an update occurs, I insert a row into a history table, so I retain all history on a table: CREATE Trigger trUpdate_MyTable ON MyTable FOR UPDATE AS INSERT INTO [MyTableHistory] ( [AuditType] ,[MyTable_ID] ,[Inserted] ...

How to have a where clause on an insert or an update in Linq to Sql?

I am trying to convert the following stored proc to a LinqToSql call (this is a simplified version of the SQL): INSERT INTO [MyTable] ([Name], [Value]) SELECT @name, @value WHERE NOT EXISTS(SELECT [Value] FROM [MyTable] WHERE [Value] = @value) The DB does not have a constraint on the field that is getting checked for so in ...

TSQL: finding unique entries in a single table

Consider a table or CTE structured like this: Name Num ---- ---- Abc 12 Abc 12 XYZ 70 XYZ 80 XYZ 85 Bar 50 Bar 55 Foo 44 Foo 44 Baz 88 The requirement is to determine the Name where multiple different Nums exist. The desired resultset is Name ---- XYZ Bar What TSQL stateme...

Adding Silverlight pages to existing ASP.net page??

Hi I know how to add SL page as a whole to existing ASP.net application. We have existing ASP.net page with few tabs. Each tab is a user control. We want to add another tab, which will host Silverlight content. Is it possible to add silverlight content in one of the tabs of a page? Any example links? Another way of putting up the sam...

What is the best way to estimate how much memory a row will require?

I'm working on a project that will have a single table holding lots and lots of rows on either a SQL Server or SQL Azure installation. I'm trying to estimate how many rows I can store per GB. Is it a matter of simply adding up the memory size of the individual column data types? Is there other overhead to consider? ...

SharePoint 2010 BCS ignores username/password in connection string

Here's my scenario. I've got SharePoint 2010 running on one server, with an SQL Server running on another. Both machines are on the same domain, but the logins involved are local to each machine. SharePoint is running as NT Authority\Network Service, if that makes any difference. I've created a BCS that pulls data from the remove SQL...

SQL Server 2008 database mirroring madness

I'm trying to get database mirroring to work on SQL Server 2008 between two computers. I checked connectivity, but here's what I end up with: on the principal machine, the server can connect to the mirror but refuses to set up a mirroring partnership due to it being 'unable to connect' (I checked connectivity, everything works). The wei...