73,648 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
38
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] ...
0
votes
1
answer
94
views
How do I get a T-SQL view based on a JSON_OBJECT to output data? [closed]
My view that puts out a JSON object:
SELECT JSON_OBJECT(
/*StaticDataStart*/
'currencyCode': 'GBP',
/*StaticDataEnd*/
'phoneNumber':dbassyOrderio.Telephone,
'email':...
0
votes
1
answer
170
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 ...
2
votes
1
answer
181
views
How to insert SM (service mark) symbol in SQL
How can I select a service mark (SM) symbol in SQL?
select CHAR(0153) --> TM
select CHAR(0174) --> ®
select CHAR(0169) --> ©
What would the equivalent be for a SM symbol?
-2
votes
0
answers
173
views
Fix an "Invalid column name" error for a valid column in a custom data type [duplicate]
I was hoping to find a workaround for an issue I am having. I believe this is a bug in SQL Server. We are using SQL Server 2022, RTM-CU20-GDR.
I have written a utility stored procedure for solving the ...
2
votes
2
answers
99
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>
&...
1
vote
1
answer
51
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 ...
2
votes
2
answers
172
views
SQL syntax for using STRING_SPLIT with OPENQUERY
I have a linked server named MyLinkedServer. The table I need to pull from has an XML column, so I can't just do SELECT * FROM MyLinkedServer.Database.dbo.Table due to known limitations with linked ...
2
votes
2
answers
113
views
Include control characters in my XML without affecting other data
My nvarchar value contains a control character - Start of Text (0x0002 / STX). I would like to include this in my XML value. Now I know XML is not tolerant of control characters so the only way I can ...
0
votes
1
answer
284
views
Using the new REGEXP_LIKE in SQL Server 2025 [closed]
As mentioned in Unlocking the Power of Regex in SQL Server, SQL Server 2025 preview would contain new REGEXP_LIKE function.
So I went to docker hub and grabbed the docker image with 2025 preview ...
0
votes
2
answers
170
views
For ERROR_NUMBER 515, how to get the column name from ERROR_MESSAGE
In many SQL error messages, SQL Server does not mention column name. But in messages such as the one shown below, the error message does include the column name.
Question: How can we extract the ...
0
votes
0
answers
95
views
SQL Server 2014 full text search can't handle short strings
I have an instance of SQL Server 2014.
I have FTS index on my Customerstable. Everything works fine but I found that it can't handle short strings. For example:
SELECT *
FROM [dbo].[Customers]
WHERE ...
3
votes
1
answer
50
views
Execute xpath having column name into a variable
I need to extract data from a XML column in SQL Server 2016, for this example I'll create a XML variable, but in the real scenario the XML in inside a table so it is not editable.
This is a sample of ...
FDB's user avatar
- 1,112
-1
votes
1
answer
183
views
Get random rows in interval in T-SQL
I need to select 10 to 20 random rows from a table. (I only can find how to select just N random rows). I need to get something like this
SELECT *
FROM table
WHERE ABS(CHECKSUM(NewId())) % 19 BETWEEN ...
1
vote
1
answer
74
views
SQL script to import a XML file [duplicate]
I'm trying to import an XML file into a SQL Server table, there are no errors, but all values are 0 instead of the actual values.
Could you please help me to understand what is wrong with my script?
...