Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Structured Query Language is a language for interacting with relational databases. Read the tag wiki's guidelines for requesting SQL reviews: 1) Provide context, 2) Include the schema, 3) If asking about performance, include indexes and the output of EXPLAIN SELECT.
2
votes
Accepted
Auditing a complex mix of reasonably small tables
This would also be the case when a user connects locally to the SQL Server instance, but if there's only one instance (i.e. not in a cluster), then it's not really a big deal, since you know which computer … ,'<local machine>'
,CAST(SERVERPROPERTY('MachineName') AS nvarchar(128)))
FROM sys.dm_exec_connections
WHERE session_id = @@SPID;
See:
SERVERPROPERTY (Transact-SQL …
2
votes
Optimize a Sql subquery containing multiple inner joins and aggregate functions
While this will usually result in a specific error message, there may be some implicit collation coversion occurring instead (see: MSDN: Collation Precedence (Transact-SQL)) between the sub-query & the … of Database and Table Column Using T-SQL
SQL SERVER – Change Collation of Database Column – T-SQL Script
Also, you may be able to trick your programming language into using a temp table with syntax …