sql-server-2005

SQL Server 2005 - Pivoting Data without a sum / count and dynamic list of values

Sorry if this is covered elsewhere in another question, but I can't find any examples which exactly match what I need and I'm getting confused. I have data in the table like this :- Name | Value --------------- John | Dog John | Cat John | Fish Bob | Python Bob | Camel And I would like the data like this.......

linked server Error

following error occur when i try to insert record from SQL server 2000 to SQL server 2005, while select query is running fine OLE DB provider "SQLNCLI" for linked server "insight_db" returned message "Protocol error in TDS stream". OLE DB provider "SQLNCLI" for linked server "insight_db" returned message "Communication link failure". Ms...

Executing queries with ExecuteWithResults using the BatchSeparator

We are using Smo.Server to run some SQL batches. For queries that create stored procedures or tables and contain the separator GO the following code works: server.ConnectionContext.ExecuteNonQuery(sql); But the following fails server.ConnectionContext.ExecuteWithResults(sql); For sql that doesn't change the database structure it se...

Sql Server 2005 Returns Results From Some Other SP

I have a data access layer which returns DataSets/DataTables by executing Stored Procedure. Everything was working fine from many months. But suddenly we have started getting the following error. System.ArgumentException; Column < ColumnName > does not belong to table < TableName > I wrote come extra logging code to troubleshoot this i...

cannot generate sspi error when connecting to sql 2005 server using winndows authentication

What are the reasons for the following error to occur when connecting to the sql server 2005? error:0 Cannot generate SSPI error I have to reproduce this error using NTLM authentication , so i want to know the exact steps to reproduce this error. i have installed client and server s/w of sql 2005 on the same machine and tried to reprod...

What should a SQL Parameter be in a update statement be when it's not required

As the the question says, what should I set the value of a parameter to if I don't want it to update the DB? e.g. UPDATE table1 SET col1 = @someval , col2 = @someotherval WHERE col3 = 1; If in my c# logic I decide that col2 does not need to be updated because the value being passed in is null, what should I set the parameters val...

SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed. [CLIENT: 127.0.0.1]

got the below error while trying to connect to sql server 2005 using JDBC connection. Error: 17806, Severity: 20, State: 2. Logon SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed. [CLIENT: 127.0.0.1] Logon ...

Transactions within loop within stored procedure

I'm working on a procedure that will update a large number of items on a remote server, using records from a local database. Here's the pseudocode. CREATE PROCEDURE UpdateRemoteServer pre-processing get cursor with ID's of records to be updated while on cursor process the item No matter how much we optimize it, th...

Store external resources in DB??

I have database items that have 2 external resources: A.) images and B.) HTML files. Should these be stored as columns in the DB, or should the DB just hold pointers to the filesystem? What are the pros and cons of each approach? HTML files are about 200k per item, and Images are about 200k per item (5 - 10 pics or so max) Thanks. ...

aspnet_regsql.exe and MVC

Can someone explain what aspnet_regsql.exe is really used for? When I create a standard ASP.NET MVC project in VS2008 and register a user, I get the db created with corresponding asp.net membership tables etc. This uses the SQL Server Express 2005 as standard. The forums I have found states that aspnet_regsql.exe is used when one is m...

SQL reporting services report not showing date in correct format

Hi, i have built a reporting services report off SQL server 2005 and am having trouble getting the date to format correctly in a stand-alone textbox. The code i am using is as follows: ="Date: " & FormatDateTime(Parameters!date.Value, 2)) -- According to MSDN it should work off my systems culture when set to '2' however it is not. C...

2005 SQL Reporting Services Dataset filter with OR not AND

Under Dataset Filters Tab, I want to use OR not AND but when I add a second Filter the AND appears in the And/Or column with no way to change it. Am I missing something? ...

i forgot the SQL 2005 tool that helps me extract the database into scripts

Hello, I forgot the name of that application tool. anyone here remembers it? It let's me log-in to my remote SQL database and I can create scripts of the schema and procedures and even data. ...

How to use DATEDIFF to return year, month and day?

How can I use DATEDIFF to return the difference between two dates in years, months and days in SQL Server 2005 DATEDIFF (date , date) How to result that: 2 year 3 month 10 day Can anyone complete this t-sql? ALTER FUNCTION [dbo].[gatYMD](@dstart VARCHAR(50), @dend VARCHAR(50)) RETURNS VARCHAR(50) AS BEGIN DECLARE @yy INT DEC...

Can’t see win2k8 server by hostname, but can see it by IP

We have set up a Windows 2008 server with MS SQL 2005 (default instance), if we try to connect using the MS SQL Server Management Studio using the server hostname it is failing. if we use localhost or it's IP it is working. We have added the server hostname to the hosts file (C:\Windows\System32\Drivers\etc) but this didn't solve the p...

Is it possible to insert into a table variable without defining the schema?

Hi all, Is it possible to insert into a table variable without defining the schema? I need to do this like Declare @tab1 as table Insert into @tab1 select * from table2 Select * from @tab1 I was trying this query but got error. Please help. ...

ignore case with regular expression

I have created a CLR in a SQL server 2005 database. It is a simple regular expression user defined function that will check if a pattern exists in the string I pass into the function. The dot net code I use in the CLR is shown below: Return System.Text.RegularExpressions.Regex.IsMatch("Input", "pattern") This returns a bit value of ...

SSAS - process top 10K rows of fact table

My environment: SQL Server 2005 for database and SQL Server 2005 Analysis Services. I have a fact table of 78M rows. I want to only process the first 10K rows in my development phase. Other than removing the rows from my Fact table, is there another way of achieving this? ...

Moving Annual Total SSAS

I have a cube and I want to create a MAT column. This column is then expected to show up in the same way as a regular metric would. How do I create a column that is a Moving Annual Total in SSAS? A walkthrough / demo would work as well. ...

Long running Jobs Performance Tips

I have been working with SQL server for a while and have used lot of performance techniques to fine tune many queries. Most of these queries were to be executed within few seconds or may be minutes. I am working with a job which loads around 100K of data and runs for around 10 hrs. What are the things I need to consider while writing ...