Hot answers tagged

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. ...
user avatar
  • 69.1k
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 [...
user avatar
  • 5,194
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, ...
user avatar
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)
user avatar
  • 475
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 ...
user avatar
  • 963
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-...
user avatar
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) ...
user avatar
  • 12.2k

Only top scored, non community-wiki answers of a minimum length are eligible