sql-server-2005

STORED PROCEDURE Calculations & performance improvements

Hi, I currently have the following stored procedure; CREATE PROCEDURE web.insertNewCampaign ( @tmp_Id BIGINT, @tmp_Title VARCHAR(100), @tmp_Content VARCHAR(8000), @tmp_Pledge DECIMAL(7,2), --@tmp_Recipients BIGINT, @tmp_Date DATETIME, @tmp_Private BIT, @tmp_Template BIGINT, @tmp_AddyBook BIGINT ) AS ...

How can I store a Word file programmatically in SQL Server 2005 with C#?

I have a button on my form. When the user clicks on the button, Microsoft Word is running. I want to store the file in SQL Server 2005, when the user saves the file. ...

How to insert values into database?

Hi guys, I have taken some text field and abd some labels and one submit and one reset button. I want to code like: when i enter some values in text boxes and click upon submit my record will get submitted into the database. And when i click upon reset then my form will get reset. Please let me know how will i code this scenario. Thank...

How to give permissions so ASP. NET website can open SQLConnection from a DLL added as a reference to the a project?

I am trying to open a SQLConnection and this exception occurs: Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details...

Track SQL Server 2005 meta changes?

I know SQL Server 2008 can do this, but essentially I need a way to log all the changes made to a database. I don't need to log selects, and I don't need to log the user, the only important data is what has been added or changed, both with regard to data and structural changes like columns, tables, and indices. What are my options? ...

Trying to delete duplicate entries in SQL database deleted all the records. What went wrong?

I tried to delete duplicate records in my DB. The only difference is the PrimaryKey which is a uniqueidentifier. I have about 1500 entries that have been duped so in all I'm looking at around 3000 entries. So I sectioned off about 60 entries (based on the receivedOn date) and executed my code to pare them down to 30 and OH CRAP the 30...

Is performance hit hard when you reinitialize a subscription in sql server 2005

Hey folks, I haven't worked with reinitializing a subscription for SQL Server 2005 replication before and the time has come. I've added a few new articles and need to push those down to the subscriber. Before I reinitialize, which I've read is what I want to do, I want to have a feel for potential performance hit when I kick it off. My ...

[SSMS 2005] CVS plugin?

Currently, I produce various .sql scripts (sprocs mainly) and have to copy them to another location where I had originally checked out a CVS project before I can add/update/remove the CVS repository accordingly (using TortoiseCVS). It's tedious, so I've been tasked with investigating if SSMS could use CVS natively. I've been googling a...

SQL Server Check/NoCheck difference in generated scripts

I am trying to sync up the schemas between to different databases. Basically, I ran tasks->Generate Scripts with SQL Server Management Studio (2005) on both databases and am comparing the output with a diff tool. For some reason, one script adds the constraint WITH CHECK and one WITH NO CHECK, followed by both constraints being re-enab...

Transaction isolation level on an oledb-connection

I have an oledb-connection from clickview to a sql2005-server and I would like this connection to use transaction isolation level of read uncommitted. My seconde choice would be to set it on the user. How can I accomplish this? ...

SQL, How to Concatenate results?

I currently have a SQL query that returns a number of fields. I need one f the fields to be effectively a sub query sub that. The Problem in detail: If I have a table X with two columns, ModuleID and say ModuleValue, how can I write a SQL query to take the results and Concatenate it into one field: EG Results returned from (SE...

Deattach a replication sql server 2005 databas.

Is there is any way to move deattach a SQL server 2005 database that is used for replication without, recreating the publishers and subscribers again at the destination? ...

SQL Server Stored Procedure store return value

Helo, My question is I have one Stored Procedure in SQL Server that returns counts of a field. I want to store the results of this Stored Procedure in a variable (scalar?) of a different stored procedure. sp_My_Other_SP: CREATE PROCEDURE [dbo].sp_My_Other_SP @variable int OUTPUT -- The returned count AS BEGIN -- SP SET NOCOUNT ON; ...

Which Join having more I/O and CPU Cyecle ?

Which Join having more I/O and CPU Cycle ? Hash join or Merge join or Loop join? ...

Indexed View vs Indexes on Table

I have the following table EVENT_LOG: EVENT_ID: pk, int, not null TYPEID: fk, int, not null CATEGORYID: fk, int, null SOURCE: varchar(255), null DESCRIPTION: varchar(4000), null CREATED: datetime, null We've been creating a report, and found that performance sucks. There aren't any indexes aside from the clustered one. We could cr...

How can I choose the closest match in SQL Server 2005?

In SQL Server 2005, I have a table of input coming in of successful sales, and a variety of tables with information on known customers, and their details. For each row of sales, I need to match 0 or 1 known customers. We have the following information coming in from the sales table: ServiceId, Address, ZipCode, EmailAddress, HomePhone,...

Best way to get data from Ms Access Mdb file to sql server 2005

We use a software which uses Sql server 2005 as back-end. The problem is we have data coming in access file and we need to store it in sql server tables. I have the sql server tables ready. I don't need all the data i get in MDB access file but need specific columns from access and then store it in SQL server. I get fresh access tab...

Does SQL Server 2k5 preserve locking hints over linked servers?

I've been nosing around--and I'm no DBA myself,--but became curious when trying to troubleshoot a particularly expensive (and infrequent) query that performs an outer join on a linked server (2k5 to 2k5, different dbs on different physical machines). The issue doesn't generally seem to be execution time, but rather locking, as the outer ...

Choosing the highest scored results from a table variable in SQL

I have the following table variable in SQL Server 2005: DECLARE @results TABLE (id int IDENTITY(1,1), customerId int, salesId int, score int, lastServiceDate datetime, PRIMARY KEY(id)); I need an efficient way to c...

How to determine a primary key for a table in SQL Server?

What I'd like to be able to do via SQL somehow is with a table name as input determine all the fields that make up the primary key. sp_columns doesn't seem to have this field. Any ideas as to where to look? EDIT: This is SQL Server 2005 Statement on Answer: While others may have been right his was the cleanest and easiest to implemen...