sql-server

SQL Server Reporting Services Mobile Views

I'm about to create a report that will be scheduled to send email updates each night. We're sending emails because we want these reports to be available outside the company firewall on BlackBerrys. This means we're limiting the functionality a fair bit (no drill down, sorting, advanced filtering and only one table worth of data). Is ther...

SQL Server 2005 & Antivirus Software

Our Network people insist on having antivirus (eTrust) software on ALL servers, including all of our SQL Server 2005 machines. How can I best demonstrate that this is hurting performance? ...

Concatenate a selected column in a single query?

I know you can do this, because I've seen it done once before, but I forget where and up until now I haven't need to do it. I have a table called Employees, and it has various employee data (duh). I need a query that will do a select on the first and last name of all rows in the table, and then contenate all of them into a comma delimit...

Appropriate .Net data type for decimal(20,0)

I've got some sql returning a decimal(20,0) data type. In SSIS I have a package with a foreach loop. In my variable mappings, what type of variable would I map it to? I've tried Int32, Int64, double, and still get the error "The type of the value being assigned to variable "User::iID" differs from the current variable type..." ...

SQL Server 2005 stored procedure fast in SSMS slow from VBA

I have a stored procedure which when run from SQL Server Management Studio consistently takes 5 seconds to run when called like this. exec dbo.MyStoredProc '2009-04-30 00:00:00', '2009-04-30 20:00:00' When called from an excel spreadsheet via VBA it takes 6 minutes plus (not including the time taken to copy the recordset to a sheet. ...

Singular or plural database table names ?

Exact Duplicate Table Naming Dilemma: Singular vs. Plural Names Is it better to use singular or plural database table names ? Is there an accepted standard ? I've heard arguments for and against it, what do you guys think ? ...

is it better to put more logic in your ON clause or should it only have the minimum necessary?

Given these two queries: Select t1.id, t2.companyName from table1 t1 INNER JOIN table2 t2 on t2.id = t1.fkId WHERE t2.aField <> 'C' OR: Select t1.id, t2.companyName from table1 t1 INNER JOIN table2 t2 on t2.id = t1.fkId and t2.aField <> 'C' Is there a demonstrable difference between the two? Seems to me that the clause ...

What is the equivalent to SQL Server Transactions in DB2?

What is the equivalent to the following SQL Server statements in DB2? Begin Transaction Commit Transaction Rollback Transaction ...

Granting Select Rights to a Stored Procedure in SQL Server 2000

I want to give a user access to a stored procedure, but not to all the objects in the database the stored procedure needs to use. What is the best way to give rights to the stored procedure to enable it to work, but only grant execute access to the user to run it. I am using sql server 2000 sp4. ...

SQL Server: varbinary or int to store a bit mask?

Is there any advantage of using int vs varbinary for storing bit masks in terms of performance or flexibility. For my purposes, I will always be doing reads on these bit masks (no writes or updates). ...

How do I run a TSQL script that returns a value?

Am I correct in saying it is TSQL? I am a novice at database scripting. Is this called scripting? I am a novice at this, really I am. I just wrote a stored procedure in SQL Server Management Studio: CREATE PROCEDURE dbo.LogTable_Count @Count INT OUT AS SELECT @Count = Count(ExperimentId) FROM LogTable GO I would like to test ...

What is a good way using LINQ To SQL to update multiple tables through a view?

I have a view and it's composed of two tables. I want to edit a value in each table through the view and save those changes but LINQ is throwing an error about not being able to edit two values on the same view. Does anyone know of a good workaround? Thanks ...

After creating a new row in the database, should I return the primary key to the row or a data transfer object?

I have a three tier system, SQL Server backend, hand written data access layer, and using stored procedures. I have a table called EventTable. Each row is an 'Event'. An Event has a primary key, and a start date. CREATE TABLE EventTable ( ID INT IDENTITY(100,1) PRIMARY KEY, StartTime DateTime NOT NULL ) There is a stored proced...

Replicate a view where the table doesn't exist ...

I am replicating from MS SQL Server 2005 to a MS SQL Server 2008 (Microsoft CRM Dynamics database). There are a number of views in the source db which no longer have their underlying tables. I have no idea why this is or how it occured. The issue is that the subscriber can't create these views so the subscription keeps failing part wa...

How to strore multiple rows in a variable in sql server08

Hi All, I want to know, How can I store multiple rows in a variable.i.e. My query will return multiple rows and i want to store it in a variable. Thanks in adv. ...

Connection problems with SQL Server in ASP.NET applications using out-of-process session state

I have several ASP.NET applications deployed in a farm of 4 Windows 2003 machines. Each application uses a separate App Pool and Virtual Directory in IIS. They rely heavily on sessions which are persisted out of process on a single SQL Server 2000 (<sessionstate mode="sqlserver" ... />). Applications are compiled against .NET 3.0 but .NE...

What is the correct way to setup readonly access to a MS Sql Ananlysis Server Cube

People don't seem to be able to get the data from the cube unless unless I set the database permission to "full control" on the server. What is the right way to give read access (only) to a cube in Microsoft SQL Server Analysis Server ...

WHERE IS NULL, IS NOT NULL or NO WHERE clause depending on SQL Server parameter value

I have a stored procedure in SQL Server 2000 that performs a search based on parameter values. For one of the parameters passed in, I need a different WHERE clause depending on its value - the problem is that the 3 values would be where MyColumn IS NULL IS NOT NULL ANY VALUE (NULL AND NOT NULL) (essentially no WHERE clause) I'm hav...

Best way to get PK Guid of inserted row

Hi all, I've read this question about getting the identity of an inserted row. My question is sort of related. Is there a way to get the guid for an inserted row? The table I am working with has a guid as the primary key (defaulted to newid), and I would like to retrieve that guid after inserting the row. Is there anything like @@IDE...

Storing HTML markup entered via web rich text editor?

Hi, I'm currently working on an admin section for a website. The admin can use the infragistics WebHtmlEditor tool to create markup for pages which will then be loaded into the pages on load. What is the best way to store this markup in the database? Should we just save the HTML generated by the WebHtmlEditor into a varchar field? I...