tsq

Server Server 'In' Statement Item Order for Performance

Given the SQL Statement: SELECT * FROM MY_TABLE WHERE SomeNumberField in (0,99999) If I can guarantee that the majority of rows in MY_TABLE have SomeNumberField set to 99999, and can project that this will remain the case indefinately, is it better to write the above query like this: SELECT * FROM MY_TABLE WHERE SomeNumberField in ...

SPROC T-SQL Syntax to return results if rows exist on multiple days

what I need to test for on my table is if there are rows for a given user id and order id on two separate days (DATETIME field for a timestamp). I'm pretty sure I'd need a having clause and that's why I'm here...that frightens me terribly. ...

How to update database when using wild characters for example like .

Hi , I have column which consists of path for example \Abc\F\E\record_123 , now i need to update the path in database where only one change i need to do is tht \Abc\F\E\record_123 = \Abc\F\G\record_123 - i want to update E to G . how to do that with update query in database . Can anyone help me its urgent. Thanks Smartdev ...

Multiple Count() from a single table.

Is there a way to get multiple counts depending on multiple conditions from the same table? eg. Count for when Days is less than 15, and count for days between 15 and 30. ...

Is it okay to use table look up functionalities in scalar function?

In our case we have some business logic that looks into several tables in a certain order, so that the first non null value from one table is used. While the look up is not hard, but it does take several lines of SQL code to accomplish. I have read about scalar valued functions in SQL Server, but don't know if the re-compliation issue af...