I've heard that you should put columns that will be the most selective at the beginning of the index declaration. Example:
CREATE NONCLUSTERED INDEX MyINDX on Table1
(
MostSelective,
SecondMost,
Least
)
First off, is what I'm saying correct? If so, am i likely to see large differences in performance by rearranging the order...
Hi All,
I have to following table in sql server:
date | status
2009-01-01 12:00:00 OK
2009-01-01 12:03:00 FAILED
2009-01-01 12:04:00 OK
2009-01-01 12:06:20 OK
2009-01-01 12:07:35 FAILED
2009-01-01 12:07:40 FAILED
2009-01-01 12:20:40 FAILED
2009-01-01 12:25:40 OK
I need the ...
I currently use Excel and SQL Server Business intelligence studio to browse my models, but I've been searching high and low for a decent, moderately user-friendly front end application that can be used for trudging through a SSAS Mining Model.
I understand how to use the predictions for specific purposes (such as integrating with call q...
Hi, I’ve got an application that uses SQL Server Express 2005 SP3. This application is distributed to several hundred users, each of whom is running XP. However, our company will be moving to Windows7 soon. My application uses the bulk insert operation in SQL Server, and it runs fine in XP. However, in Windows7 I need to open SQL Ser...
I'd like to create a single trace file using SQL Profiler that spans several days so I can run it through DTA to get some advice on indexes. My issue is that I would be doing this on my laptop, which i shutdown and take home everynight, so i can't just pause it when i leave and start it when i get back. Also the server is taken down ev...
I have an ASP.NET app using built-in Membership functionality. As such, I have a connection string in my web.config that looks like this:
<add name="MembershipSqlServer" connectionString="Data Source=servername;Database=aspnetdb;uid=user;pwd=password;" />
When working on my dev machine, everything is peachy keen. But when I move thi...
I'm trying to optimize a complex SQL query and getting wildly different results when I make seemingly inconsequential changes.
For example, this takes 336 ms to run:
Declare @InstanceID int set @InstanceID=1;
With myResults as (
Select
Row = Row_Number() Over (Order by sv.LastFirst),
ContactID
From DirectoryC...
What's the difference between the difference some of the Microsoft Unified Communication Products? Primarily Microsoft Office Live Meeting and Microsoft Office Communicator? The two seem very similar, but I don't quite know what each one is especially useful for.
Or are they all integrated into one product, but marketed as different pro...
I'm trying to select DISTINCT rows from a view using ROW_NUMBER() OVER for paging. When I switched the ORDER BY field from a SMALLDATETIME to INT I started getting weird results:
SELECT RowId, Title, HitCount FROM
( SELECT DISTINCT Title, HitCount, ROW_NUMBER() OVER(ORDER BY HitCount DESC) AS RowId FROM ou_v_Articles T ) AS Temp
WHERE ...
I have 4 databases mirrored using High Protection mode without witness server between two servers(principal and mirror) that are in the same domain. Manual failover worked fine for several days. But later somehow the IP of the principal server was changed in the DNS, then onwards the mirror state of these databses went to disconneted sta...
I have to make a list of tables and their columns that are having keyword 'EMP' in their column name. The database is having around 160 tables. Is there any way of finding this quick ?
...
SELECT region, person, sum(dollars) as thousands
FROM sales
GROUP BY region, person
ORDER BY region, sum(dollars) desc
The SQL above produces a complete list of sales people per region like this
region person thousands
canada mike smith $114
canada joe blog $76
canada pete dodd $45
usa ...
Is it possible to take Backup of SQL Server Compact database (i.e. *.sdf) and Restore the same.
...
Question: when I create a table (T_TableName) using SQL Server Management-Studio, it always creates the table as
Domain\UserName.T_TableName
instead of
dbo.T_TableName
What's wrong ?
...
I have the following query:
SELECT
CAST([Action] AS NVARCHAR(4000)) AS CastAction,
CHARINDEX(CAST([Action] AS NVARCHAR(4000)), N'StatusChange') AS FoundIndex
FROM AuditTrail
WHERE action LIKE '%StatusChange%'
Action is an NTEXT field - this query returns many rows, matching StatusChange in the action text, but the charindex r...
I basically have an application that has, say 5 threads, which each read from a table. The query is a simple SELECT TOP 1 * from the table, but I want to enforce a lock so that the next thread will select the next record from the table and not the locked one. When the application has finished it's task, it will update the locked record...
For a typical team of 20 .net developers how many sql developers and DBA's should be allocated ?
...
Is there a maximum?
Will SQL Server start throwing SqlExceptions when maximum is reached?
How do you solve it? (archiving?)
From the SQL Server resources I can see that the maximum is 2,147,483,647. I'm far from that, but I was just curious.
...
How can this be achieved in SQL (MS SQL)
Thanks
OK: let me bit clear what am trying to acheive is generating dynamic select statement with EXCEPT clause.
eg: select col1,col2,col3 from @table
except
select col1,col2,col2 from @table
so my resultset will be always different based on @table
futher down i want to use this @ta...
hi,
i get this error when i inserting the data in a table this is my error
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_playlistvideos_videos". The conflict occurred in database "tpvnew", table "dbo.videos", column 'videoid'.
...