Skip to main content
0 votes
0 answers
49 views

Table-valued functions working alone but not working in a cross join [closed]

i've been stuck debuggin an SQL table valued function. The function itself works like a charm. If i test the function in a simple script DECLARE @input NVARCHAR(MAX) = 'TEXTTOIGNORE ADD BLABLABLA DEL ...
user1375452's user avatar
0 votes
1 answer
49 views

sp_delete_database_firewall_rule fails for greyed out firewall rules

I'm looking at the Networking settings for one or our Azure SQL servers, and I see some of them are greyed out. Azure Portal shows a message "You can use TSQL to remove or modify greyed out rules....
DinahMoeHumm's user avatar
2 votes
1 answer
79 views

Way to simply list the Forms of a word by the full-text parser?

We're using fulltext indexes in current builds of SQL Server and/or Azure SQL - compatibility levels well over SQL Server 2016 or higher, preferably SQL Server 2022 on Azure. While the searching in a ...
DinahMoeHumm's user avatar
0 votes
1 answer
65 views

Varying SQl query results [duplicate]

I have a table valued function called "elara_customer_byname". When I execute SELECT * FROM elara_customer_byname('%Kar%') I get 2 rows, which is incorrect. If I copy the SQL from the ...
Karlton Kemerait's user avatar
-4 votes
1 answer
173 views

Recursive CTE looking for all combinations of values that equal one target amount

I found examples online using a recursive CTE to find all combinations of values that equal one target amount. The database column ledger_amount is DECIMAL(26,6). DECLARE @TARGET_AMOUNT DECIMAL(26, 6) ...
DoctorKennyG's user avatar
-8 votes
1 answer
122 views

Find total minutes [duplicate]

Note that it's saved in time datatype. So if I have someone that started work at let's say 5:30 am and ended their shift at 10:00 am Is there faster way than: declare @Shiftstart time; declare @...
asri Allaham's user avatar
0 votes
1 answer
101 views

Aggregate function for bit-wise OR [duplicate]

In SQL Server 2022, is there an aggregate function for doing a bit-wise OR against a particular column? -- Example table, data and output to show the different flags DECLARE @TEST TABLE (FLAGS TINYINT)...
freefaller's user avatar
0 votes
0 answers
37 views

Is there a faster/cleaner/more elegant way to write this SQL Server OPENJSON code block? [duplicate]

I need to extract most keys/values separately, but also to collect the value of the entire 'wms' key into a single field. I am not the most experienced with OPENJSON(), so this is what I came up with (...
Chris Taliercio's user avatar
1 vote
2 answers
122 views

Change columns to not nullable if they're nullable

I have a group of tables being updated/replaced by an outside process. I need to add a primary key to make my queries run faster. However, if the column I'm using is nullable, it obviously won't be ...
Johnny Bones's user avatar
  • 8,502
0 votes
0 answers
58 views

Getting this error running sp_blitzCache on one database: Error message is: The ''' character, hexadecimal value 0x27, cannot be included in a name

On one of our databases, when I attempt to run sp_blitzCache, I receive the error: Error message is: The ''' character, hexadecimal value 0x27, cannot be included in a name. Procedure fails to ...
BMac's user avatar
  • 1
-1 votes
1 answer
61 views

Best way to Index and or Key massive datasets [closed]

I have two tables related to each other, each with roughly 200M records. CREATE TABLE [dbo].[AS_tblTBCDEF]( [CDEF_SOC_NUM] [numeric](5, 0) NULL, [CDEF_EFF_DATE] [date] NULL, [CDEF_TYP_BUS] ...
Johnny Bones's user avatar
  • 8,502
0 votes
1 answer
186 views

Does source length of SQL functions matter

First, to define what I'm talking about, the "length" of a source is how many characters it has. Having more characters allows improving readability by using more descriptive function and ...
Vladimirs Kacs's user avatar
2 votes
1 answer
192 views

How to insert SM (service mark) symbol in SQL

How can I select a service mark (SM) symbol in SQL? select CHAR(0153) --> ™ select CHAR(0174) --> ® select CHAR(0169) --> © What would the equivalent be for a SM symbol?
Jesse O's user avatar
  • 67
2 votes
2 answers
106 views

Keep ancestors/siblings structure in XQuery query() method

Take this for example: DECLARE @xml XML = N' <members> <member> <name>John</name> <age>32</age> </member> <member> &...
Miles Fan's user avatar
1 vote
1 answer
56 views

Trying to convert .NET Ticks to Central Time but without the offset

In a SELECT statement I want to convert .NET ticks to a datetime and display in Central Time. I don't want the timestamp+offset that "AT TIME ZONE 'Central Standard Time'" gives, I just want ...
Sam Clark's user avatar

15 30 50 per page
1
2 3 4 5
4911