| | |
Description | Compatibility | Level/ Author | Views/ Date Submitted | User Rating |
| |
| |
 |
Dynamic SQL Query (3 lines basic) | SQL Server 2000, SQL Server 7.0 | Beginner / Soki Gakiya | 5277 since 8/7/2004 1:47:21 AM |
By 1 Users
|
| |
Dynamic queries on SQL are difficult, because you might need to evaluate a field based on whether a filter was specified or not, one way to perform this task is using an EXEC statement with a variable with the Query itself in it, but the scope goes one le ...(description truncated) |
| |
| |
| |
 |
Eliminate duplicates | SQL Server 7.0 | Intermediate / James Travis | 10749 since 7/13/2001 8:35:53 PM |
By 5 Users 5 Excellent Ratings
|
| |
To elminate duplicates from results from table in which version history exists so you have the most current data only output to screen. |
| |
| |
| |
 |
Extract the last string | SQL Server 2000 | Intermediate / Developer142 | 2787 since 7/2/2009 8:56:47 AM | Unrated
|
| |
To extract the last strings from "A1, B1, ABC" |
| |
Please support the site by visiting our
sponsor:
|
| |
| |
 |
Fastest way to get say only one matching address row for each person out of a set of duplicates | SQL Server 7.0, SQL Server 6.5 and earlier | Intermediate / Umachandar | 6387 since 7/29/2000 10:02:17 PM |
By 1 Users
|
| |
This is the fastest way to get say only one matching address row for each person out of a set of duplicates. This logic assumes that you do not care which address row you want to display. It can be easily extended to include other checks say based on the ...(description truncated) |
| |
| |
| |
 |
Fetching Parent Child Records | SQL Server 2000 | Advanced / Developer142 | 2762 since 7/2/2009 8:57:00 AM | Unrated
|
| |
I have a table(e.g. tblParentChild) with two columns(say ParentId & ChildId)
It goes like this
ChildId ParentId
-------- -------
1 Null
2 1
3 2
4 3
5 4
Output:
Parent Child1 Child2 Child3
----- ------ ---------- ...(description truncated) |
| |
| |
| |
 |
Finally a LIMIT clause for MS SQL | SQL Server 2000, SQL Server 7.0 | Intermediate / _CodeJack_ | 199266 since 6/29/2004 3:56:31 PM |
By 10 Users 9 Excellent Ratings
|
| |
This query gives you the same ability as a LIMIT clause does in MySQL and Oracle for MS SQL Server without the headaches of stored procedures or temp tables. |
| |
| |
| |
 |
find a particular character in a column | Oracle | Intermediate / Andy Archer | 6667 since 9/7/2012 4:51:37 PM |
By 1 Users
|
| |
This example PL/SQL cursor uses the TRANSLATE built-in to find rows in a table that have a special character (from the set specified in the TRANSLATE) in one or more of their varchar2 columns. No looping required. |
| |
| |
| |
 |
find all check constraints | Oracle | Intermediate / Andy Archer | 6158 since 10/21/2008 4:25:53 PM |
By 2 Users
|
| |
This SQL*Plus script runs SQL to find check constraint info on all user tables, spools the results to a file, and opens the file in Notepad. Reveals business rules embedded in the database as column check constraints. |
| |
| |
| |
 |
find all columns with <string> in their name | Oracle | Intermediate / Andy Archer | 9201 since 3/4/2013 3:41:04 PM |
By 2 Users
|
| |
This script solicits a string at the SQL*Plus prompt, runs SQL to find all user columns with that string in their name, spools the results to a file, and opens the file in Notepad. |
| |
| |
| |
 |
find all foreign key references for a column | Oracle | Advanced / Andy Archer | 3903 since 5/15/2009 8:28:17 AM | Unrated
|
| |
This script solicits a user column name and table name at the SQL*Plus prompt, runs SQL to find all user tables where that column is referenced as a foreign key, spools the results to a file, and opens the file in Notepad. Very handy. |
| |