Viewing 15 posts - 31 through 45 (of 61 total)
I recently saw this syntax used in an example - SELECT <col_name> INTO <new_table> FROM (SELECT 'Literal') AS EX(<col_name>); Now I have figured out what it accomplishes...
October 4, 2022 at 10:40 am
It's a shame you're on SQL Server 2012 because the graph database functionality implemented in SQL Server 2017 is perfect for this.
Might be worth installing somewhere and testing/creating...
September 30, 2022 at 12:04 pm
I'd have one DimOrder row per order. Say the order total is £10,000, made on June 1st and they pay in three instalments of £5,000, £3,000 and £2,000, made on...
September 26, 2022 at 1:29 pm
I'd suggest DimOrder as a normal conformed dimension.
I'd also suggest that you have negative surrogate keys that will allow you to report smarter:
It's common practice to have -1 as an...
September 26, 2022 at 12:34 pm
Joining fact tables isn't a great idea - people may get confused, performance won't be great, etc.
Do payments always relate to an order or can there be another source?
I'd be...
September 26, 2022 at 12:10 pm
Please read this article. The FORMAT() function performs very badly.
Agreed, I was just tidying up their code. An alternative:
SELECT
CONVERT(VARCHAR(25),Datefield,105)+' '+CONVERT(VARCHAR(25),Datefield,108)
FROM
Table1
September 26, 2022 at 10:38 am
Change hh to HH
Also if you actually want your format, change your "/"s to "-"s
September 26, 2022 at 8:32 am
Add
LEFT OUTER JOIN dbo.TrainingParticipants ON dbo.TrainingParticipants.TrainingID = dbo.TrainingHeader.TrainingID
to the bottom of your query.
September 23, 2022 at 10:45 am
Your join between TrainingHeader and TrainingParticipants (on ParticipantID = TrainingID) returns 13 rows as a left outer join and only 1 row as an inner join. Are you sure your...
September 23, 2022 at 9:43 am
Hello there. What query are you running to not return the right result?
September 23, 2022 at 8:46 am
CAST(Timestamp AS DATE) will do that for you. It will strip the time part out.
2022-09-22 14:30:54.843 becomes 2022-09-22
WITH TEST
AS (SELECT CAST(CURRENT_TIMESTAMP AS DATE) JUSTDATE,
CURRENT_TIMESTAMP TSTAMP
UNION
SELECT CAST(CURRENT_TIMESTAMP AS...
September 22, 2022 at 1:34 pm
Basic stuff @voldemarg.
Distinct dates
SELECT COUNT(DISTINCT CAST(timestamp AS DATE)) FROM TABLE
Rows per day
SELECT CAST(timestamp AS DATE) AS TransactionDate, COUNT(*) FROM TABLE GROUP BY...
September 22, 2022 at 9:23 am
Good to hear you've got a working solution. Communication is the key now - make sure you're told in advance if the format will change again so you've got time...
September 22, 2022 at 8:36 am
Will it always be that format:
Apple (red) (23)
Apple (23)
Grape (green) (12)
Grape (12)
And so on?
If so, you could use a CASE expression to count the number of opening brackets:
CASE WHEN LEN(Fields!Field.Value)...
September 21, 2022 at 9:30 am
This thread on MSDN should help:
September 21, 2022 at 9:19 am
Viewing 15 posts - 31 through 45 (of 61 total)