I have a junction table in my SQL Server 2005 database that consist of two columns:
object_id (uniqueidentifier)
property_id (integer)
These values together make a compound primary key.
What's the best way to create this PK index for SELECT performance?
If the columns were two integers, I would just use a compound clustered index (...
I'm having trouble figuring out how to delete a set of records when a particular field is less than the date on the sql server without using tables or field names.
Since I'm using MSSQL the query would look something like this:
DELETE FROM tickets WHERE expires < getdate()
How would I go about getting Hibernate to do this? I'm lookin...
I have an asp app that runs against SQL Server 2005 and I'd like to run processes that:
query data,
manipulate data, and
send emails containing particular data and analysis
What is the easiest way to do this in SQL Server 2005? Can I do this in an SSIS package? Should I use CLR procedures?
...
I want to move a table schema from one database to another using vb.net or c#. How can I do that?
Thanks in advance
...
I'm writing an export function, where I need to export contacts to Excel, and I've run into a technical snag - or perhaps a gap in my SQL skills is closer to the truth. ;)
Here's the scenario:
I've got a bunch of contacts in a database. Each contact can have many different roles, for example a contact can be both C# Developer and DBA, o...
how to write 2 tables and how insert into it in a single statement
...
I am trying to run the code sample from Workflow Foundation which uses persistence service's functionality. In the code I've observed:
Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;
When I run the code I am getting an exception. How do I enable persistence services on my SQLEXPRESS server?
...
Hi. During the ASP.NET execution of my app, it seems SQL 2008 Express holds some lock, and I get
Timeout expired. The timeout period elapsed prior to completion of
the operation or the server is not
responding
Maybe some of my query is not optimized. Visual Studio crashes with:
Microsoft Visual Studio may be unstable now. ...
I've a report whith an odd performance issue. When running it under the following conditions, SSRS Server (UAT_SSRS) & SQL Server (SERVER_SQL) I'm getting a TimeDataRetrieval value of 23726. When I run it under a different SSRS server (PROD_SSRS) and still use the same SQL server (SERVER_SQL) the value for is 325952 (well over TEN TIME...
I use MS SQL 2008 and I want to create a trigger in a database that is created dynamic.
Creating the database is called within a stored procedure of an other database and runs perfectly, but when I want to add a trigger or a stored procedure, the executing fails.
If I try to run the dynamiy SQL with an
EXEC('USE dbase
GO
CREATE TRIGGE...
I have a table myTable with a unique clustered index myId with fill factor 100%
Its an integer, starting at zero (but its not an identity column for the table)
I need to add a new type of row to the table.
It might be nice if I could distinguish these rows by using negative values of myId.
Would having negative values incur extra page s...
Often when I find an article in the SQL Server BOL I see that the article has an address of ms-help://
but I can't forward this "uri" to a colleague who doesn't have the Sql Server BOL --- so the question is is there a consistent mapping between ms-help:// and http://msdn.microsoft.com
...
I have a Sales table, with the following columns:
employeeID
amount
date
Now I want to SUM up the last 15 rows, so I am currently doing:
SELECT TOP 15 SUM(amount) FROM Sales ORDER BY [Date] DESC
But I get 15 rows obviously, is there a way I can sum it up and not have to loop through and SUM it on the client side?
...
I need to prove that the encryption settings we have in our app's connection string are working. Would would be the simplest way to validate that traffic from our web site to the sql server is in fact encrypted.
...
Is there a way to change sql server's instance name with reinstalling everything?
...
I'm attempting to retool myself more towards .NET (coming from an opensource background) and am looking at learning Microsoft SQL Server to complement my skills in C#. How easy would it be to transfer my skills from Postgres to Microsoft SQL Server? Furthermore would a book on SQL Server 2005 (Database Essentials - Step by Step, Microsof...
For one of my applications, I'm running SQL Server 2005, and I'm running it on localhost. When I'm accessing it though the application it takes it 1-10 seconds to start showing data if I'm accessing it on localhost. However, when I move away from localhost and access it from another computer on the network, the access time is around one ...
In SQL Server 2005+ (I use both), does adding the UNIQUE constraint to a column automatically create an index, or should I still CREATE INDEX?
...
I'm using Visual Studio Team System 2008's Database tools to develop my databases. On my local dev machine, when I want to deploy schema changes to the SQL Server instance on my machine, I just use the Data --> Schema Compare feature of VS2008.
But with live databases I can't do this because I can't connect to the database directly from...
I have a table where I created an INSTEAD OF trigger to enforce some business rules.
The issue is that when I insert data into this table, SCOPE_IDENTITY() returns a NULL value, rather than the actual inserted identity.
Insert + Scope code
INSERT INTO [dbo].[Payment]([DateFrom], [DateTo], [CustomerId], [AdminId])
VALUES ('2009-01-20',...