sql-server-2008

sql left join with distinct correct?

I'm trying to do a join between tables 1 and 2 which have a 1 to many relationship. table1 has the following fields createdate contact tkey (surrogate key) table2 has the following fields tkey (primary key) status userfld1 description I want to show all items in table2 with their corresponding items in table1 grouped by...

Cannot connect to SQL server 2008 Express instance

Hello, i have an instance of SQL server 2008 and an instance of SQL server 2008 Express. i have been mainly using the SQL server 2008 instance with the following connection string... <add name="Local-DB-connection" connectionString="Data Source=JONATHAN-PC; Database=dbname; User ID=uname; Password=pword;" providerName="System.Data.Sql...

Does SQL Server 2008 Enterprise Edition trial version supports clustering and auditing?

I am going to download SQL Server 2008 Enterprise Edition trial version, my doubt is does this trial version fully functional or some limited functionalities? Does it supports Audit and Clustering features? ...

Creating SSIS Custom Data Flow Component + SSIS 2008

Hello Am a newbie to to SSIS Custom Component. Just started to code a component where the input row count will never be same as output row count. foreach input row it does some validation and generates n rows which need to be mapped to output buffer. So after with Design time validation coding everything is fine. my RunTime code is ...

Should i use MAXDOP to improve my maintenance stored procedure?

Okay so i understand the basics of MAXDOP, but i want to understand if this a valid scenario for using it. I have a stored procedure which is quite resource hungry, but has been optimized to the max. It currently takes 30 minutes (local) to refresh an entire system (what is refreshes isnt really important). This procedure will get exec...

Web Application working in VS Development Server but don't work in IIS

I've a ASP.Net application which utilizes SQL Server Stored Procedures and Web Services using Windows Authentication. The idea is to use the logged in user credentials for invoking the web service (This is critical since the web service use the authentication credentials to assign the owner of the created or updated record) and for execu...

How to create maintenance plan in sql server?

when i m trying to create new maintenance plan in sql server it is popping up this error- TITLE: Microsoft SQL Server Management Studio ------------------------------ 'Agent XPs' component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Agent XPs' by using sp_configu...

sqlserver 2008 triggers

I have a table with a trigger (for update) to set the LastEditedTime field when a change if made - simple enough. I also have a trigger (after update) to set LastStatusChangedTime. The problem is as follows: Is there any performance issue if i use two triggers for update? or can i combine two triggers into one? I'm wondering how othe...

VS2010 Database Project to Drop Database before deploy?

Is it possible to get VS to drop the destination database before a deploy? I've tried adding a post deploy script to the project, but it always comes back with active connections. Any ideas? Thanks! ...

How to access my database from another server

Hi Everyone, DB: SQL Server 2008 I have two servers A and B. I want to able to insert data from server A into server B using a particular user. I can't seem to find a syntax for doing that. Can anyone please help me out on this. Thanks ...

SQL Server: unique key for batch loads

Hi, I am working on a data warehousing project where several systems are loading data into a staging area for subsequent processing. Each table has a "loadId" column which is a foreign key against the "loads" table, which contains information such as the time of the load, the user account, etc. Currently, the source system calls a sto...

Getting rid of full index scan

Hi, The following query performs badly because of a full non-clustered index scan of 6.5 million records in P4FileReleases followed by a hash join. I'm looking for possible reasons the optimizer picks a scan over a seek. SELECT p4f.FileReleaseID FROM P4FileReleases p4f INNER JOIN AnalyzedFileView af ON p4f.FileRelease = ...

Uninstalling VS Setup project prerequisites

We currently use a VS 2010 (upgraded from 2008) setup project to install our application, and utilize the SQL Server 2008 install prerequisite. Well wouldn't you know, management has got it in their head that everything (including prerequisites, but not .net) that's installed by the application must now be uninstalled by the uninstaller...

Estimated Subtree Cost Wildly Off, Terrible Optimization

I am joining a table that has two record id fields (record1, record2) to a view twice--once on each record--and selecting the top 1000. The view consists of several rather large tables, and it's id field is a string concatenation of their respective Ids (this was necessary for some third party software that requires a unique ID for the ...

What is the use of sp_addextendedproperty in SSIS packages?

How to use sp_addextendedproperty for package audit ...

Certain Files getting corrupted by SQL Server FileStream

I am saving files to a SQL server 2008 (Express) database using FILESTREAM, the trouble I'm having is that certain files seem to be getting corrupted in the process. For example if I save a word or excel document in one of the newer formats (docx, or xslx) then when I try to open the file I get an error message saying that the data is c...

First call using SQLClient to SQL 2008 creates timeout. All subsequent calls are fine.

UPDATE: I have determined that the SQLClient code times out on the first call, but works on all subsequent calls. Also, when connecting with Management Studio, it times out the first time as well, then connects when I try again. Ideas? Original: Hey guys, I have a very strange issue that I can't seem to resolve. I have an application...

t-sql select query filter

Based on the below table and inputs: Id RelatedId -------------- 1 1 1 2 1 3 2 2 2 3 2 4 3 5 Inputs are @input_1 = 2 and @input_2 = 3 (input count can vary) I want to select only those Ids from the above table that have both these input in their corresponding RelatedIds. So, based on the give inputs, output will be...

Advice on using (or not using) XML in a hierarchical object model

I'm developing a hierarchical object model that is self-referencing as a 0/1 --> * relationship. An object without a parentID is a root element. The parentID is also the foreign key on the self-join. From my understanding, using the parentID as a foreign key will only point to a column where child elements may be found --> does this forc...

SQL Server 2008 Remove Case Sensitive Check

Hi, i just installed SQL Server 2008 and imported AdventureWorksDatabase (for SQL 2005, as for 2008 that didn't worked). It is now enforcing case sensitivity when i searched for any tables, views etc Hence Person.contact table when written throws an error of Invalid column name, but when Person.Contact is written it shows all rows. Pl...