I was reading through the BNF grammar for transaction statements and saw that transaction modes can be specified directly in the START TRANSACTION statement. Is there a difference in specifying transaction modes in START TRANSACTION vs SET TRANSACTION statements? Answer No difference. The SET TRANSACTION setting only affects the single next transaction to be started. Use SET SESSION to set
Tag: ansi-sql
Extract substring from column based on values from another table in SQL
In SQL (let’s assume ANSI standard SQL), is it possible to extract a substring from one column, based on another table, and put this substring into another column? Example, from the following tables: The idea is to extract the location from the summary column and output the following: Answer You can do pattern matching: As commented by jarlh ANSI sql
How to select only the first elements satisfying a condition?
I have the following table (simplification of the real problem): Now a simple SELECT id FROM Table WHERE value=’T’; would get me all the IDs where value is T, but I just need, in the example above, the first 2 (1 and 2). What is the best way to do this? I’d prefer not to use a while loop. I
ANSI SQL version of SELECT TOP 1
Is there an ANSI SQL compliant version of SQL SERVER’s SELECT TOP n?
How to rewrite IS DISTINCT FROM and IS NOT DISTINCT FROM in SQL Server 20008R2?
How do you rewrite expressions containing the standard IS DISTINCT FROM and IS NOT DISTINCT FROM operators in the SQL implementation in Microsoft SQL Server 2008R2 that does not support them? Answer The IS DISTINCT FROM predicate was introduced as feature T151 of SQL:1999, and its readable negation, IS NOT DISTINCT FROM, was added as feature T152 of SQL:2003. The
There are a method to paging using ANSI SQL only?
I know: Firebird: FIRST and SKIP; MySQL: LIMIT; SQL Server: ROW_NUMBER(); Does someone knows a SQL ANSI way to perform result paging?