sql-server

How to return empty groups in SQL GROUP BY clause

I have a query to return how much is spent on-contract and off-contract at each location, that returns something like this: Location | ContractStatus | Expenses -------------+----------------+--------- New York | Ad-hoc | 2043.47 New York | Contracted | 2894.57 Philadelphia | Ad-hoc | 3922.53 Seattle ...

List of SQL Server errors that should be retried?

Is there a concise list of SQL Server stored procedure errors that make sense to automatically retry? Obviously, retrying a "login failed" error doesn't make sense, but retrying "timeout" does. I'm thinking it might be easier to specify which errors to retry than to specify which errors not to retry. So, besides "timeout" errors, what o...

Unexpected #temp table performance

Bounty open: Ok people, the boss needs an answer and I need a pay rise. It doesn't seem to be a cold caching issue. UPDATE: I've followed the advice below to no avail. How ever the client statistics threw up an interesting set of number. #temp vs @temp Number of INSERT, DELETE and UPDATE statements 0 vs 1 Rows affected by INSERT, DE...

asp.net windows authentication to sql server

I can not seem to get sql server to recognize my credentials. Asp.net recognizes me when I login but when I execute a sql command I get a login failed message. The IIS server and SQL server are on different machines. There are other applications the IIS server which are able to authenticate to the sql server. I believe the Active D...

sql reporting services deployment

I am a beginner user of SQL Reporting Services. I wrote a few reports. They all use stored procedures on my development SQL server. Now I want to deploy them into production, and repoint the datasets and datasources to my production SQL db. How best to do this? Can I just do a global change from development_server_name to production_ser...

How Do I Update A Table From A Different SQL Server

I have a table in a database on my development(local workstation) SQL Server 2008 Express that I have added some records to. Now, I would like to deploy this table to the production SQL Server 2000 located on a server. What is the best was to accomplish this? I want to retain the data from the development instance. Both tables have the e...

How can I connect to a SQL Server in ColdFusion 7 without a DSN?

I'm writing a CFC on a server running Coldfusion MX 7. The CFC needs to be able to query a database the location of which will be determined at runtime. The database is SQL Server 2005. The CFC takes the IP address of the server and the name of the database as arguments, and the built-in Windows Authentication should allow connections fr...

What would be a best way to notify an application (C++ or Java) when underlying DB changes?

I'm writing a C++ console application that needs to respond to a change in a specific field of a database table. Though I can keep sending a query to check the field periodically, I'd like to avoid this because multiple instances of this application might be running. I have heard of the Query Notification feature of SQL Server 2005 but i...

Testing custom ORM solution performance overhead - how to?

I have created a prototype of a custom ORM tool using aspect oriented programming (PostSHarp) and achieving persistence ignorance (before compile-time). Now I tried to find out how much overhead does it introduce compared to using pure DataReader and ADO.NET. I made a test case - insert, read, delete data (about 1000 records) in MS SQL S...

separate database for SSIS logging

Hi, I read it somewhere" "A separate database should be created if SSIS logging is required. (Do not use the Sysdtslog90 table in either master or msdb. This is not a security related concern but could be a performance issue since SSIS can generate a lot of logging data. Microsoft recommends creating a separate datab...

LINQ to SQL - Restrict Relationship by Condition (One to Many) (1 - M)

OK, first off, I'm brand new to LINQ2SQL so excuse my ignorance. I've done some searches, but after 1 hour, I decided to come here. Here goes: I'm trying to do something that I think is very simple. It could just be that I don't understand. I'm using LINQ 2 SQL, via the VS designer. I have 2 tables: Clients and Categories. A client ca...

SQL to identify missing week

I have a database table with the following structure - Week_End Sales 2009-11-01 43223.43 2009-11-08 4324.23 2009-11-15 64343.23 ... Week_End is a datetime column, and the date increments by 7 days with each new entry. What I want is a SQL statement that will identify if there is a week missing in the sequence. So, i...

best practices- analysis server ans sql browser

Hi, I read somewhere: Analysis services should run under network account Ensure SQL Browser uses a domain account Why is that? ...

SQL to identify out of tolerance values

I have a database table with the following structure - Week_End Sales 2009-11-01 43223.43 2009-11-08 4324.23 2009-11-15 64343.23 ... What I want is a SQL statement that will take a start and end date, and identify all rows within that period where the sales figure is more than 3% above or below the average sales f...

Help with PIVOT

I have a table as follows Name | Words A words for A1 here B words for B1 here C words for C1 here A words for A2 here B words for B2 here C words for C2 here I want to pivot the above table to get the following result A ...

Loop in a sql query

Hi, In my Sql database, I have tables 1 Account_Customer -AccountID -CustomerID -Account_CustomerID 2 Accounts -AccountID -Balance 3 Customers -CustomerID -Name -Sex -Age 4 Loans -LoanID -Amount -BranchName 5 Loan_Customer -Loan_CustomerID -LoanID -CustomerID and I want to write a stored procedure for Listing customers togethe...

SQL Server 2005 slows down as I keep adding rows

As a preface, I am brand new to using SQL Server 2005; I know how to use the SELECT, UPDATE, DELETE, and INSERT commands and that's about it. I am also using Express Edition on my local PC (E8400 processor, 8GB of DDR2-800, 2 x 640GB SATA-II HDD in RAID 1) I have a table that I set up with 8 columns, all are NVARCHAR(Max) and I allow Nu...

Why there is a discrepancy in the result?

If I apply Binet Formula and Recursive formula for finding the fibonaci series, there is a discrepancy in result. Why? Basically I am a student and it is our assignment to implement the fibbonacci series. So I while making the experiment I came across this situation. Thanks in advance ...

Finding approximately duplicate database records using T-SQL?

Hey all. I have a MSSQL 2008 database with a fair number of rows. As of now, before new rows are inserted into the table, the stored procedure checks to see if that record already exists in the database (by checking a column labeled Title). This check is exact, and if the to-be-inserted record is slightly different, it will insert it ins...

SQL Server PIVOT Column Data

Hi, I have a table with data as given below: DATE Price ---------- ------ 31/12/2009 10 31/12/2009 11 31/12/2009 12 30/12/2009 20 30/12/2009 21 30/12/2009 22 29/12/2009 30 29/12/2009 32 29/12/2009 31 I want to convert this data as given below: 31/12/2009 30/12/2009 29/12/2009 ---------- ---------- ------...