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 |
Writing queries to request or change information stored in a database or other information management system. Questions should include table and index definitions, sample data, expected output, and a tag for the specific system (e.g. MySQL, PostgreSQL, Oracle, SQL Server, MongoDB).
1
vote
Accepted
Show Primary and Secondary Accounts in a table
If you use sql server 2017 you could use the STRING_AGG function
and your query would look like
SELECT testRelate.AccountRef AS ACref,STRING_AGG(testRelate_2.AccountRef, ', ')
FROM testRelate AS testRelate …
0
votes
Accepted
Split time in intervals of 15
Hello I create a temporary table variable type to not create the table
DECLARE @tbl_provider_available_schedule TABLE
(
[id] [int] NOT NULL IDENTITY(1, 1),
[practiceid] [int] NULL,
[p …
0
votes
Accepted
List of databases which a user can access in SQL 2008 R2
Try with this
USE master;
GO
EXECUTE AS LOGIN = N'LoginName';
GO
SELECT name
FROM sys.sysdatabases
WHERE HAS_DBACCESS(name) = 1
GO
REVERT;
2
votes
Accepted
Query to get the physical file name of the database
You can try this.
@Stringss is a variable to simulate the field you already obtained
DECLARE @String NVARCHAR(MAX)='S:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\tempdb.mdf'
…