sql-server

When does it make sense to have a single transaction per multiple database connections?

Can anyone help me see in what kind of scenarios it would make sense to have one shared database transaction and multiple connections? Thanks. ...

Returning non-printable sybol (enter) to SQL Server from C# via CLR

Hello. I have the following CLR function: [Microsoft.SqlServer.Server.SqlFunction] public static SqlString PrintText(SqlString text) { // Put your code here return new SqlString(text.Value); } And I want to get an enter symbol when passing '\r\n' to it. But insteat I get '\r\n' Could you please tell me w...

Why do multiple WHERE conditions slow query rather than speed it up?

The problem is that the query in question runs very slow when compared to the query run with one or two, rather than all three of its conditions. Now the query. Select Count(*) From SearchTable Where [Date] >= '8/1/2009' AND [Zip] In (Select ZipCode from dbo.ZipCodesForRadius('30348', 150)) AND FreeText([D...

Intern Training - Best Approach?

We have an intern starting next week. He has a Computer Science degree but no real development experience in .NET or SQL Server. We'd like to get him to the point where he is at least semi-productive in C# and SQL Server. What suggestions might any of you have, who have gone through this, regarding how best to starting training him in C#...

What are SQL Execution Plans and how can they help me?

I've been hearing a lot lately that I ought to take a look at the execution plan of my SQL to make a judgment on how well it will perform. However, I'm not really sure where to begin with this feature or what exactly it means. I'm looking for either a good explanation of what the execution plan does, what its limitations are, and how I...

How to list available SQL Server instance in a network?

I want to write a program that allows user to select one SQL Server instances in an network. How can I list available instances in a C# program? Addition questions: How can I know that a database is currently mirroring? Is there a way to know what instance is it's partner and it's witness? Thank you very much! ...

Calculate total running time from start/stop timestamps

I have a table containing a number of timestamps per day, they represents start and stop events. ID TimeStamp ---------------------- 1 2008-01-01 07:00:00 1 2008-01-01 08:15:00 1 2008-01-01 10:00:00 1 2008-01-01 11:00:00 1 2008-01-02 10:30:00 1 2008-01-02 12:00:00 I would like to calcuate the total running time per day, like th...

TSQL make trigger fail silently

I have some code in an after insert trigger that may potentially fail. Such a failure isn't crucial and should not rollback the transaction. How can I trap the error inside the trigger and have the rest of the transaction execute normally? The example below shows what I mean. The trigger intentionally creates an error condition with th...

Size of SQL Server tempDB for Data Warehouse

Is there an expected size of tempDB for a Data Warehouse application. Is 10 gigs excessive? It's hit by frequent large queries. The Data Warehouse itself is 50 gigs. I'm using SQL Server 2000 ...

Can SQL Server EKM be used with MS Certificate Service?

Hi there, I am trying to implement EKM and feel current 3rd party products are a bit pricy. Can i simply use MS Certificate Service for EKM? Thanks, Ebe. ...

How to find recursively self-joined records from a table.

I've got a simple problem that really has me stumped. I have a master table Table X Table X ID _________ 1 2 3 4 5 I have a join table for Table X that allows records to be self joined. Let's call this JoinTableX JoinTableX RecordAID RecordBID --------- -------- 1 2 (So Record 1 from Table X has a link to Record 2 fr...

SQL Server 2005: How Secure is SQL Server Authentication?

If you use SQL Server Authentication (2005), are the login details sent in clear text over the wire? ...

linq to sql vs ado.net entities

If I am using SQL Server as my database service, is there any compelling reason to look at LINQ to Entities over Linq to SQL? ...

Has anyone converted an existing .NET application with SQL Server backend to work with Oracle

I am looking to modify a .NET application that has a SQL Server backend to make it work with Oracle. Has anyone done this? Any pitfalls that I can avoid? ...

IF UPDATE() in SQL server trigger

If there's: IF UPDATE (col1) ...in the SQL server trigger on a table, does it return true only if col1 has been changed or been updated? I have a regular update query like UPDATE table-name SET col1 = 'x', col2 = 'y' WHERE id = 999 Now what my concern is if the "col1" was 'x' previously then again we updated it to '...

Is there a way to publish SQL Server database diagrams to html format?

Currently, we model our databases in Rational Rose. And, it provides the capability to export the database relationship diagrams to a html tree. Does SQL Server or any other tool allow a similar output? We'd like the ability to document our design and deliver it to our customer in an easy way. ...

Simpilify query for SQL table with 12 columns for month

I have a table in production with 12 columns for each month. I need to create a SP where I pass in a productID, Customer and Month parameter and retrieve the sum of that month. currently my logic is if month = 1 then select sum(JAN) from table where productID = @id and customer = @cust if month = 2 then select SUM(FEB) from table ...

How SQL Server processes simultaneous requests?

If multiple queries to one and the same large table come to SQL Server at the same time, how SQL Server resolves conflicts in this case? When using LINQ to SQL queries in WPF application for install on many PC's, working in network with SQL Server database, should I somehow implement mechanism for resolving such issues or am I protected...

.NET Folder Permission Issue

I'm making a software that tries to restore a database to sql server, but for that, i need Full Control over the folder that will host .mdf and .ldf files, I'm using the System.Security.AccessControl classes to give Full control for everyone but its not working! I just don't know why its happening... The app aplies the rules ok, but when...

Scripting a distributed transaction on SQL

Hello Im using SQL Server with distributed transaction on local Oracles Linked servers, as the following : GO BEGIN DISTRIBUTED TRANSACTION; SET XACT_ABORT off; GO SELECT MAX(DEPTNO)+1, FROM [WSF08_CONTA_ORADATA_II]..[SCOTT].DEPT SET XACT_ABORT on; GO COMMIT TRANSACTION; So when I run this script I get the follows er...