Viewing 15 posts - 31 through 45 (of 4,075 total)
I'll guess since you didn't post a way for anyone to post tested code.
Use LEAD to access subsequent data in the current row. Then compare AgentExpDate to the LEAD...
September 6, 2024 at 3:11 pm
Do it in the other order. Use UPDATE to update the records using the OUTPUT clause to output your required fields.
Drew
August 28, 2024 at 1:31 pm
Did you try:
Select 'Restored' as source, AppUser.UserId, usergroup.Name, AppUser.UserName
from AppUser
INNER JOIN RestoredDatabase.dbo.AppUser_UserGroup
ON AppUser.UserId = AppUser_UserGroup.UserId
INNER JOIN RestoredDatabase.dbo.UserGroup
...
July 31, 2024 at 4:20 pm
This "check" field, is this something that you create as a field in a table? Because I've never seen that done.
What is the reasoning behind not using BIT flags? ...
July 1, 2024 at 2:39 pm
The fact that you're getting duplicates is an issue with your logic. You haven't given us enough information to troubleshoot the logic, but it's probably do to the fact that...
June 20, 2024 at 2:05 pm
We definitely need more information, because, as currently written, the second table is completely unnecessary.
Drew
June 20, 2024 at 1:42 pm
This gets close to what you want. It uses an ILTV function for the tally table. It essentially uses a running total modulo 2 to determine whether a certain value...
June 6, 2024 at 7:03 pm
This is about as close as you can get using SQL. If you want more control over your formatting, you should use a reporting tool.
SELECT CASE WHEN...
May 14, 2024 at 4:01 pm
I'm not the OP. The UDF (dbo.fnTally) is a well know one by Jeff Moden and the OP is using this in his original post.
The depth...
May 7, 2024 at 3:55 pm
Not sure exactly what you want, but maybe something like this?
Create some data:
-- Creating the table
CREATE TABLE DrillingData (
PROJECT NVARCHAR(50),
...
May 7, 2024 at 2:50 pm
Many people are hesitant to open random files from the Internet. Here is a link on Forum Etiquette: How to post data/code on a forum to get the best...
May 7, 2024 at 1:54 pm
Admittedly your description is a bit vague, but it sounds like you are trying to force SQL into an object-oriented paradigm. For instance you mention "84 data values representing his...
May 2, 2024 at 3:31 pm
I've always thought you should only use inner join if you want to return columns from the other table, but this link suggests join is preferable if there is...
April 16, 2024 at 5:56 pm
This produces the exact same results as Jonathan's query with far fewer reads.
WITH CTE AS
(
SELECT xp.RBDTYR
...
April 11, 2024 at 7:56 pm
The problem is that you chose to create a DENORMALIZED names table. It sounds like you're early enough to change this to NORMALIZED. That will fix your problems.
Drew
April 11, 2024 at 2:22 pm
Viewing 15 posts - 31 through 45 (of 4,075 total)