Viewing 15 posts - 1 through 15 (of 15 total)
I have broken up the solution for explanation. I broke it into 3 logical parts.
1) Use 'cross apply' with string_split to list each word for each CompanyName
2) Use left to...
March 24, 2023 at 2:59 pm
You can use "CHARINDEX" to find out the position of that character. Then you would use "SUBSTRING" to extract each of the two strings you want. That is the basics.
March 24, 2023 at 1:57 pm
Modified to do the group by using the "Timestamp_datetime" field in case someone has the scenario where the time stamp is not already available as a seconds value. I just...
March 3, 2023 at 6:03 pm
I would use ' ' (space) between the date and time value. I would then cast the result as a 'datetime' data type.
Also, some of the test data has invalid...
March 3, 2023 at 5:24 pm
You may want to use "ALTER COLUMN" syntax rather than "ADD/DROP COLUMN" to preserve any security configuration the that could exist on the column.
February 17, 2023 at 6:08 pm
Based on the stated assumptions I would suggest the following.
/*--- Initial setup
--- Cretae synonyms to reference the remote table\s
I use a synonym to...
February 11, 2023 at 11:23 pm
lalitprg2017, for giving you a solution I would have to make some assumptions. Please tell me if you see then as reasonable for you situation. The assumptions are:
February 11, 2023 at 6:43 pm
lalitprg2017, please confirm whether my understanding is correct.
When things are running both DB-s hold the same data. What you want is that after an outage happens in one DB, lets...
February 10, 2023 at 7:50 pm
Can we see how "scratch.dbo.DelimitedSplit8K" does the spliting of the string?
Here is a function of my own that does the spliting:
create FUNCTION [dbo].[fn_tbl_StringParseByDelimiter](@InputString ...
February 10, 2023 at 1:49 pm
The " ORDER BY id DESC " portion on your solution is unnecessary. I don't think it help in any way, not even performance. Am I wrong?
If you want the...
February 9, 2023 at 3:37 pm
I agree with Steve Jones. Based on what you say I think using linked tables in Microsoft Access linked to the tables in SQL server will do the job for...
February 8, 2023 at 5:24 pm
I modified "pietlinden" solution to use a left join rather than EXCEPT. I find it more clear.
select xj.UserId, xj.ProductId
from (
select u.UserId, ProductId = p.id
from ( select...
February 8, 2023 at 4:59 pm
I modified "pietlinden" solution to use a left join rather than EXCEPT. I find it more clear.
select xj.UserId, xj.ProductId
from (
select u.UserId, ProductId = p.id
from ( select...
February 8, 2023 at 4:59 pm
Look at the OPENJSON (Transact-SQL) function.
https://www.sqlservercentral.com/forums/topic/converting-nested-json-document-to-sql-data
OPENJSON is a table-valued function that parses JSON text and returns objects and properties from the JSON input as rows and columns.
February 8, 2023 at 3:40 pm
Assuming your fact table is something like this:
create table ##Temp_CustomerAppointments
(
Customer varchar(10)
, AppointmentType varchar(20)
, Other varchar(30)
)
This query will get you the result: (The list of customers that have appointment of all...
January 19, 2023 at 10:02 pm
Viewing 15 posts - 1 through 15 (of 15 total)