Tuesday, July 21, 2015

Using case in select query in sql server

Top sites by search query "using case in select query in sql server"

Inserting multiple rows in one SQL statement


  http://blog.bflarsen.com/?p=7
Updating indexes is often the slowest part of inserting rows into a table, and inserting several at one time only rebuilds the index once (after all the rows are added) rather than once per row. Why I used UNION ALL instead of UNION UNION ALL will offer significantly better performance than UNION, because the UNION command assumes that if there are duplicates they should be removed (mathematically speaking, the union of two sets includes only one copy of the overlapped region.) If you use UNION ALL, it keeps both copies of the overlapped region

How to Get Week Day Name using T-SQL in MS SQL Server


  http://www.kodyaz.com/articles/get-week-day-name-of-date-using-t-sql.aspx
Here, you can find below a T-SQL user-defined function which returns the week day of a date send as parameter to the user defined function taking into consideration of @@DateFirst server parameter. Since I used to work on SQL Servers distributed on different parts of the World, the @@DateFirst parameter could be set different among database servers

  http://raresql.com/2013/06/28/sql-server-how-to-use-if-else-in-where-clause/
Fill in your details below or click an icon to log in: Email (required) (Address never made public) Name (required) Website You are commenting using your WordPress.com account

Performance Tuning SQL Server Cursors - SQL Server Performance


  http://www.sql-server-performance.com/2007/cursors/
The greater the number of rows being modified, the greater the locks, and the higher the likelihood of lock contention on the server, hurting performance. LOCAL cursors are more secure as they cannot be referenced outside the procedure or trigger unless they are passed back to the calling procedure or trigger, or by using an output parameter

Use Table-Valued Functions as Arrays in SQL Server - CodeProject


  http://www.codeproject.com/Articles/17802/Use-Table-Valued-Functions-as-Arrays-in-SQL-Server
Although you can't put a list of values in one parameter, you can use one parameter per value: SELECT * FROM table WHERE field IN ( @Param0 , @Param1 ) So if you know how many values to expect there's no trouble using parameters with IN. 2) Using a DataReader you can loop thru the order records and store them in a local data structure (collection) and then call the DataReader's NextResult method (or is it NextRecordset?) to read the detail records from the same data reader

  http://www.shabdar.org/sql-server/105-store-save-images-in-sql-server.html
When I open image from hard disk, all edit functions work perfectly but when I open image from database and try to edit it, no function works :( Kindly help me out..

  http://blog.skufel.net/2012/01/how-to-use-sql-server-to-query-active-directory/
Since I am able to bring in one record at a time, is it possible to create a sql user function to pull in multiple records for say, an SSRS report? Reply 4-18-14 Sri says: Enjoy.. We manage our SSRS folder permissions using AD and it would be a huge benefit to be able to query AD to get a list of who has permissions to folders and reports on our SSRS

  http://www.bennadel.com/blog/938-using-a-sql-join-in-a-sql-update-statement-thanks-john-eric.htm
OR GIVE ME A EXAMPLE TO KNOW HOW TO DOTHANK YOU VERY MUCH!! Dave Oct 27, 2009 at 9:50 PM 1 Comments Hi J.D,If you can join ECRPYHS and ECRHDHS, it should be easy to join PAYINFO as well. It doesn't happen all that often (most of my SQL is fairly simple), but every now and then someone shows me something that just rocks my world, whether it be the power of Indexing or just something as simple as using UNION ALL instead of UNION

  http://oracle.ittoolbox.com/groups/technical-functional/oracle-dev-l/count-function-using-case-statement-in-sql-query-841539
No spaces please The Profile Name is already in use Password Notify me of new activity in this group: Real Time Daily Never Keep me informed of the latest: White Papers Newsletter Jobs By clicking "Join Now", you agree to Toolbox for Technology terms of use, and have read and understand our privacy policy. Simone Isabela replied Apr 16, 2010 For me this work very well: select dptno, sum (case when condition1 then 1 else 0 end ) as cnt1, sum (case when condition2 then 1 else 0 end ) as cnt2, sum (case when condition3 then 1 else 0 end ) as cnt3, from emp group by dptno Using sum like thanhtt says works fine

  http://scottelkin.com/sql/using-a-case-statement-in-a-sql-where-clause/
Take an example I just ran into: I want to show all orders to every employee unless the order is assigned to employeeid 263, EXCEPT if the person trying to view all orders IS employeeid 263 or if it is that persons boss

Case sensitive search in SQL Server queries : Narayana Vyas Kondreddi's home page


  http://vyaskn.tripod.com/case_sensitive_search_in_sql_server.htm
It is important to note that, if and when you migrate the following queries onto a case sensitive database, it is better to get rid of the additional bits from the WHERE clause, and compare normally. That means, you can have a default SQL Server installation with case insensitive collation, but a specific database or a set of columns can have case sensitive collation

  http://blog.sqlauthority.com/2013/04/30/sql-server-update-from-select-statement-using-join-in-update-statement-multiple-tables-in-update-statement/
-- Check the content of the table SELECT * FROM Table1 SELECT * FROM Table2 GO As you can see that using JOIN clause in UPDATE statement it makes it very easy to update data in one table from another table. However, the easiest and the most clean way is to use JOIN clause in the UPDATE statement and use multiple tables in the UPDATE statement and do the task

  http://blog.sqlauthority.com/2007/07/17/sql-server-case-statement-in-order-by-clause-order-by-using-variable/
And it take around 3-4 second to load records But if i put fixed order by with direction then it will not 1 second so can you please help me to optimize my query. Fill in your details below or click an icon to log in: Email (required) (Address never made public) Name (required) Website You are commenting using your WordPress.com account

No comments:

Post a Comment