sql-server-2005

DateDiff SQL Server Problem

Could some one please explain this to me as I am a touch confused as to why this is happening? Basically what I would like to know is why there is a difference between Sundays date and every other day of this week in weeks from the year 0. If that makes sense! I tried setting the date first but this had no effect. Surely Monday – Sunday...

Report Builder Entity navigation

Hi, I am trying to use Report Builder (ver 9) as bundled with SQL Server 2005. I am able to select my data source from the report server, and load all the relevant entities associated with the data source fine. However when I try and navigate entities I am unable to view the entire list of entities again. There is no 'back or forward na...

How can I track which user has last modified the stored proc in sql server 2005+?

Inspired by this question How can I quickly identify most recently modified stored procedures in SQL Server I am wondering if at the same time we can identify the user? How to do this using sql program(if any possible)? I am eager to know. Thanks in advance ...

Truncate Table and UPDATE Statistics

Do we need to Update table statistics after calling Truncate table or it gets updated automatically? Q: Do we need to call "UPDATE STATISTICS" after truncating a table? ...

TSQL: Cannot perform an aggregate function AVG on COUNT(*) to find busiest hours of day

Consider a SQL Server table that holds log data. The important parts are: CREATE TABLE [dbo].[CustomerLog]( [ID] [int] IDENTITY(1,1) NOT NULL, [CustID] [int] NOT NULL, [VisitDate] [datetime] NOT NULL, CONSTRAINT [PK_CustomerLog] PRIMARY KEY CLUSTERED ([ID] ASC)) ON [PRIMARY] The query here is around finding the distributi...

A good SQL strategy for fuzzy matching possible duplicates using SQL Server 2005

I want to find possible candidate duplicate records in a large database matching on fields like COMPANYNAME and ADDRESSLINE1 Example: For a record with the following COMPANYNAME: "Acme, Inc." I would like for my query to spit out other records with these COMPANYNAME values as possible dups: "Acme Corporation" "Acme, Incorporated...

PRINT Statements and Performance

I have a job with around 100K records to process. There are many print statements which get executed for each record. Does these print statements have any impact on performance? For that matter, does number of lines or comments have any impact on performance? I want to save even a single ms if I can. ...

What's the best SQL Server setup for a development environment?

Hi, We are a small team using Visual Studio 2008 for development and SQL Server 2008 Standard in the production servers. We are seting up a new development lab and I am wondering about SQL Server versions/editions and configuration. Visual Studio 2008 comes with a development license of SQL Server 2005, but since we are only targetting...

Sql existence check for Xml Schema Collection?

Hey all, writing scripts for Sql Server 2005. I am registering a schema with CREATE XML SCHEMA COLLECTION [dbo].[MySchema] AS N'<xsd:schema ... >' Now, as I make changes, I would like to drop it, say with a call to DROP XML SCHEMA COLLECTION [dbo].[MySchema] I run this stuff fairly frequently as I am developing, like DROP ... CRE...

Computed Column cannot be Persisted

I have function which I am using in one of the SQL Job (see function below). I am trying to created a persisted column on this function based on existing column on the same table. It is giving me following error. Computed column 'FormattedSSN' in table 'SomeTable' cannot be persisted because the column is non-deterministic. ...

Wrong value when casting a float(24)value to float(53) in SQL 2005

I am running this sql code in SQL 2005 declare @a as float(24) set @a=0.85 select cast ( @a as float(53)) and the result is 0.850000023841858 does anyone know why? Thanks. ...

Having issues connecting to a server with VS Pro

I just purchased a hosting account from Go Daddy with a SQL Server database and I'm trying to connect to it with VS Pro. I've tried everything I can think of, and called Go Daddy as well. I have SQL server 2008 on my machine, but Go Daddy has SQL Server 2005 - Which I'm sure will bring about even more issues... In my server explorer, ...

Index and Insert Operations

I have one job with around 100K records to process. This job truncates the destination tables, and then insert all the records "one at a time", not a batch insert, in these tables. I need to know how indexes will take affect as these records are inserted? Whether cost of creating index during the job will be more than benefit from using...

Performance impact - varbinary(max) and triggers

I was reading other post related to a problem I'm facing (http://stackoverflow.com/questions/1477690/what-is-the-benefit-of-having-varbinary-field-in-a-separate-1-1-table) looking for an aswer but I cant find one since a have a different scenario. I've read splitting varbinary(max) data into another table would no get performance improv...

Why Sql Indexed View always use Clustered Index

I need some pointer on how to debug the following problem. Environment: SQL Server 2005 Enterprise. I have an indexed view with contains clustered index and multiple non-unique, non-clustered index. However when I execute the query, SQL server always perform Clustered index scan instead of index seek on my key. Here is a simplify vers...

How to get the list of java processes along with their PID(process id) that are running on UAT server under a specfic account?

Problem: A jar file was failed to deploy on a UAT server. Reason: Because when we are trying to rename it,it is showing "cannot rename the file it is been used by another user". step choosen in order to solve the problem log on UAT server(xxx). we need the list of java processes along with the PID on our UAT server which is r...

What is Knowledge Discovery and Data Mining?

I suppose SQL queries fetch "raw data"... Is there any good point to start regarding data mining in SQL server? Are there any available KDD ready-to-go, algorithms in MS-SQL server 2005, 2008? ...

How To use a stored procedure in a crystal reports 8.5?

Hi all.... I have to make a new report using crystal report8.5 . I have created a stored procedure in SQL Server 2005. The stored procedure has one input parameter. Now I wanna to know that how I can add that stored procedure and show its result in my report while designing that report? thank you ...

Most efficient way to store number 11.111 in SQL Server

What datatype is the most efficient to store a number such as 11.111. The numbers will have up 2 digits before the point and up to three after. Currently the column is a 'bigint', I am guessing that this will need to be changed to a decimal or a float. Any help much appreciated. thanks ...

SQL Server database is not visible

I have installed ASP.NET application with database on our server. ASP.NET application created database using connection string below. The problem is that I do not see database in SQL Server Management Studio. I use "Windows Authentication" account to login to SQL Server. How to solve this problem? Also I see two sqlservr.exe instances in...