sql-server

Getting rid of Table Spool in SQL Server Execution plan

I have a query that creates several temporary tables and then inserts data into them. From what I understand this is a potential cause of Table Spool. When I look at my execution plan the bulk of my processing is spent on Table Spool. Are there any good techniques for improving these types of performance problems? Would using a view ...

SSIS: "Failure inserting into the read-only column <ColumnName>"

I have an Excel source going into an OLE DB destination. I'm inserting data into a view that has an INSTEAD OF trigger that handles all inserts. When I try to execute the package I receive this error: "Failure inserting into the read-only column ColumnName" What can I do to let SSIS know that this view is safe to insert into be...

ssis 2008 transactions

Hi, I am using SSIS 2008 for the loading of data from txt file to sql. In this scenario I want to revert all the data if package failes in any component for that I used transaction: required at package level and transaction: supported at all data flow levels but it is not giving the desired results. Could any one give possible solutions ...

Export a database query to OPML?

Is there a way to export a database query to OPML? ...

Installation error with SQL Server (Null reference)

I try to install ScrewTurnWiki with SQL Server 2008 as its data store, get the following error,can someone please shine some light please? ********update*********** here are the values I set in the web.config and 9 tables have been created in the database when I browse to the site. <add key="SettingsStorageProviderConfig" value="Data ...

generate script of content of one table as a .sql file(via code)

is this possible that i create a stored procedure that generates content of defined table to a path that i passed as its(stored procedure) parameter? ...

How can I rewrite this statement?

I have declared a variable @date SELECT @date = CASE WHEN MAX(dt) IS NULL THEN '31/12/2009' ELSE MAX(dt) + 1 END FROM mytab A code snippet where I am using the local variable CASE WHEN MAX(DateValue)= @date THEN NULL ELSE CONVERT(varchar(10), CONVERT(datetime, MAX(DateValue)), 103) END AS newdt I don't wa...

How to avoid NULL when using Value-Name Mapping in SQL

I have a table like the following which is basically used to "give a name" to a value in a table (this table contains values for a bunch of other tables as well, not just for MYTABLE; I've omitted a few irrelevant fields from NAMEVALUEMAP): NAMEVALUEMAP Table --------------------- VALUE_ | NAME_ --------------------- 0 | ZERO 1 ...

Real examples of SQL injection issues for SQL Server using only a Replace as prevention?

I know that dynamic SQL queries are bad due to the SQL Injection issues (as well as performance and other issues). I also know that parameterized queries are prefered to avoid injection issues, we all know that. But my client is still very stubborn and thinks that just var UserName=Request.Form["UserName"]; UserName=UserName.Replace...

sql server - help in query

I have a table called employee_salary_master in which we keep salary effective dates and entry dates of each employee in the company. For processing salary of an employee for a month, we need to fetch most recently entered record. If the effective date is less than that month then we pick the most recent entry. but if effective date is ...

what does Sql Server Management want to save into "Solution1"?

what is "solution1"? what is it for? When I exit ssms, it asks me to save something under Solution1 David ...

Add IIS 7 AppPool Identities as SQL Server Logons

Hi, I'm running an IIS 7 Website with an AppPool of Integrated Pipeline Mode. The AppPools does NOT run under NetworkService, etc.. identity (by purpose), but uses it's own AppPool Identitiy (IIS AppPool\MyAppPool). This is a so called service account or virtual account. (a user account, which is not a full account...) I'd like to giv...

what is the best db strategy for column indexing?

Two examples are: Columns that will show up in a queries where clause (where Name = "xtz") Columns that you are going to order (sort) on in queries Is this correct and are there other important use cases? Can SQL Server recommend fields to index based on usage patterns ? ...

Stored Procedure in SQL 2008

I have create a stored procedure with VB.NET This procedure goes to a remote Server (for the moment on my near server Win 2003) until now everything are ok The procedure is created and i call her from my program The name is sp_AddStreamDB mycommand = new sqlcommand("EXEC sp_AddStreamDB 'C:\sqlDATA\', 'RemoteDB'",RemoteSQLConn) myComm...

LINQ to SQL -DAL

I wish to Implement LINQ-to-SQL as my Data Access Layer. I am using SQL Server. Is there any Linq-to-SQL framework (commercial or open source) available that can function like Application Block (caching block, validation, etc..)? ...

Install order for SQL Server 2005 developer and VS 2008 on Windows 7

I always seem to battle with this so on my new Windows 7 dev PC build, I thought I'd try and get it right! Do you install VS 2008 first and then SQL Server 2005 developer or the other way around? And for either way, are there any special options/settings that have to be enabled/disabled? I've just take an Acronis image of my PC, config...

How best to represent rational numbers in SQL Server?

I'm working with data that is natively supplied as rational numbers. I have a slick generic C# class which beautifully represents this data in C# and allows conversion to many other forms. Unfortunately, when I turn around and want to store this in SQL, I've got a couple solutions in mind but none of them are very satisfying. Here is an...

How can i retrieve a table from stored procedure to a datatable

I created a stored procedure so as to return me a table something like that create procedure sp_returnTable body of procedure select * from table end When i call this sp on frontend what code i need to write to retrieve it in a datatable object. I wrote code something like this one. I basically want to know retrieving and storing ta...

PostgreSQL and/or SQL Server alternatives to Oracle's SYS_CONTEXT

Having used an Oracle DB for a while, I got used to using the Oracle DB Application Context to implement access restrictions. To simply put it, upon login a procedure is called that puts the user details into the Oracle Application context like so: DBMS_SESSION.SET_CONTEXT('context_name', 'user_id', user_id); Then access can be enforc...

Troubleshooting SQL Server connection issues.

I'm relatively inexperienced at SQL Server, but am trying to troubleshoot some of the (non-SQL Server-related) logic and UI issues in a Delphi app someone else wrote which uses it. Currently trying to get the dev environment functioning. Here's the environment: Dev machine: Virtual machine (VMWare) running Windows XP, using Bridged Net...