3
votes
ownership chaining not working with sp_cursorfetch
This appears to be peculiar to keyset cursors, where ownership chaining does not work as expected for scalar functions in the fetch portion of the cursor plan.
The issue is not limited to API cursors. ...
2
votes
Accepted
Generate JSON with property names that include dot using SELECT FOR JSON
You can use FOR JSON AUTO which ignores . characters in keys.
In this case, you need to place it in a subquery, otherwise you cannot get the value key
SELECT
[Id],
JSON_QUERY((
SELECT
[...
1
vote
Using Boolean Fields in a View to Identify Linked Tables
For the record, there is no Boolean data type in SQL Server. Bit is a numerical type, limited to the values 0 and 1 (and NULL).
That is not the same as a Boolean type, which could be true, false, ...
1
vote
Row_number to not increment if values on three columns are the same from the row before
Based on your description, what you want should be
dense_rank() over (partition by orderid
order by DocumentNo_, CurrentPackageTrackingNo)
1
vote
Generate JSON with property names that include dot using SELECT FOR JSON
One solution (in addition to my other answer) is to be a bit more explicit in the JSON structure you wish to generate. Basically, here you are providing FOR JSON with some already properly-parsed ...
1
vote
Setting up reporting and alerting in SQL Server through TSQL and Powershell
Create agent event alert for the errors that are written to the event log. Here's a util I did that generates a bunch, and can serve as a starting point. https://karaszi.com/agent-alerts-management-...
1
vote
Accepted
Must declare the scalar variable "@Name"
I fixed your code and reformatted it.
DROP TABLE IF EXISTS #linkedservers;
CREATE TABLE #linkedservers
(
SRV_NAME sysname NULL,
SRV_PROVIDERNAME nvarchar(128) NULL,
SRV_PRODUCT nvarchar(128) ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
t-sql × 2910sql-server × 2333
sql-server-2008-r2 × 356
sql-server-2012 × 269
sql-server-2008 × 207
sql-server-2014 × 154
performance × 151
stored-procedures × 150
sql-server-2016 × 144
query-performance × 74
ssms × 71
query × 62
join × 57
trigger × 55
sql-server-2005 × 54
index × 53
dynamic-sql × 51
execution-plan × 48
update × 47
optimization × 45
database-design × 43
pivot × 43
cte × 35
sql-server-2017 × 34
functions × 34