sql-server-2005

Are there any automated white box testing tools for T-SQL stored procedures and/or functions?

I was wondering if there are any tools similar to Pex that analyze T-SQL stored procedures and functions (instead of managed code) in order to generate meaningful and interesting input values for parameterized unit tests. ...

Where can I find deadlock log information

Where can I find documentation that explains all the cryptic information returned in the SQL Server logs when a deadlock occurs? I've read several articles that describe some of the items, but I'm trying to find the definitive docs understanding deadlock-list log information and how to use the information when diagnosing the problem. Fo...

Question about Time Statistics, Execution Plan and "print"

In trying to determine what area of a large query i have is causing performance problems i took three steps. Including the execution plan, setting time statistics to on and printing immediately before and after sections that i believe might cause a problem. Example: print '1' SELECT ID FROM Test print '2' When i look at my execution...

How to save file in SQL Server database if have file path??

I am building some C# desktop application and I need to save file into database. I have come up with some file chooser which give me correct path of the file. Now I have question how to save that file into database by using its path. ...

How to return SQL Server 2005/2008 columns as identical child nodes using FOR XML query?

Basically I need to return some data from a SQL Server table in the following XML format: <querydata> <entity name="Person.Contact"> <row> <field name="FirstName">Gustavo</field> <field name="LastName">Achong</field> </row> <row> <field name="FirstName">Catherine</field> <field name="LastName">Abel<...

Sql server takes too long time for update query to execute for few rows

Hi Guys, UPDATE table1 SET col1='True' This query takes more than 30 secs for about 6000 records. Why is it so slow? ...

Sqlconnection does not support parallel transactions

I want to run two transactions simultaneously. So i gave MultipleActiveResultSet = false in the connection string as specified in an MSDN article. But after modifying the connection string i get "Target machine actively refused". I'm working with WCF. Any ideas in this? Thank you. ...

How to add Row_number to table function results

I have a function that returns groups(clusters) from a table.. create function dbo.ftAllClusters() returns table as return select distinct Cluster from Company Now I need to add RowNumber for each of the row returned.. ...

Can I trust Execution plans ?

I have these Queries: With CTE(comno) as (select distinct comno=ErpEnterpriseId from company) select id=Row_number() over(order by comno),comno from cte select comno=ErpEnterpriseId,RowNo=Row_number() over (order by erpEnterpriseId) from company group by ErpEnterpriseId SELECT erpEnterpriseId, ROW_NUMBER() OVER(ORDER BY erpEnterpris...

Cross-tab Query

Hello, I have a table with employee attendance - lets say - OATT. Following is the structure and sample data AttDate EmpId EmpName AttCode InTime OutTime 01-10-2009 1 Jain, Rahul P 0900 1830 02-10-2009 1 Jain, Rahul P 0900 1830 03-10-2009 1 Jain, Rahul P 0900 1830 04-10-2009 1 Jain, Rahul P 0900 1830 05-10-2009 1 Jain, Rahul P 0900 18...

What GUID can I use as a placeholder

I have a database table that has a non null column of type uniqueidentifier. This was put in place for use in the near future. But for now, I need to use some placeholder. Can I simply use: 00000000-0000-0000-0000-000000000000 for all the rows until a real guid is used when new rows are inserted in the future? Does SQL Server enforce ...

Sql Server: Count records (including zero) per ten-minute intervals

I currently have a table (SQL Server 2005) that logs the visits against my web app, and I want to put together some code to report (and display a visualization) of that traffic. What I want is to display the number of visits during each ten-minute interval over the last 24 hours. I have a query that does just that, but there are ten-min...

smart device pocket pc application in asp.net plus sql server

Hi, I want to connect to sql server database with smart device pocket pc application. i want to retrive all records of table from sql server database and want to show in gridview. so for this purpose i want coding for connection to database, not using wizard... Thanks in advance ...

Client Access License (CAL) in SQL Server 2005 standard Edition

Hi, I am using SQL server 2005 Standard Edition SP3 for installing my application DB. My SQL installation returns License type is "DISABLED" and number of Licenses (CALs) is "NULL". I have done performance testing on my webmodule pointing to this DB using load runner tool. Simultaneous connections on the web module is limited to aroun...

Is it.. Good / Bad / Okay ... to use IF/While Conditions in Stored Procedures ?

My primary concern is with SQL Server 2005... I went through many website and each tells something different. What are the scenarios that are good / ok to use.. For example does it hurts to even set variable values inside IF or only if I run a query. Supposing my SPs is building a dynamic SQL based of several conditions in Input Param...

What is "Audit Logout" in SQL Server Profiler?

I'm running a data import (using C#/Linq), and naturally I'm trying to optimize my queries as much as possible. To this end I'm running a trace on the DB using SQL Server Profiler, with my trace filtered by my SQL login name (it's a name that can uniquely be attributed to my data import process). Strangely enough, most of my SQL statem...

Expected OR Similar Output

HI, I am having data as shown below ItemCode Attr1 Attr1 InStock ITEM-000001 43 S 1 ITEM-000001 52 L 2 ITEM-000006 42 R 1 ITEM-000006 44 R 2 ITEM-000009 56 R 1 ITEM-000011 40 R 2 And by using Pivot table (or any other technique) i want the reslut like as Output f...

SQL figuring out days remaining based on days interval (using SQL Server 2005)?

I have a table that represents a user's subscription to our system. I have two tables. One represents the subscription for an account and the other represents the type of subscription. The subscription table relates to the subscription type table with a subscriptionTypeID field in the subscription types table. I need to figure out the da...

nvarchar(max) vs NText

What are the advantages and disadvantages of using the nvarchar(max) vs. NText data types in SQL Server? I don't need backward compatibility, so it is fine that nvarchar(max) isn't supported in older SQL Server releases. Edit: Apparently the question also applies to TEXT and IMAGE vs. varchar(max) and varbinary(max), for those searching...

Performing string concatenation from rows of data in a TSQL view (pivot?)

I'd like to create a view in SQL Server that combines several pieces of database metadata. One piece of metadata I want lives in the sys.syscomments table - the relevent columns are as follows: id colid text ---- ------ ------------- 1001 1 A comment. 1002 1 This is a lo 1002 2 ng comment. 1003 1 This is an e...