The CIO of our company started giving time for shout-outs/high-fives in our weekly IT Standup meetings. Just a few minutes to say thanks for a couple of people who went above and beyond for the week and truly made a difference.
Unfortunately, it only took about four weeks and it turned into a...
Just a thought...have you considered just adding an INDEX to your existing VIEW that is slow and cumbersome?
Create Indexed Views
Robert "Wizard" Johnson III
U.S. Military Vets MC
Data Integration Engineer
We could argue all day on standards and naming conventions. Everyone has personal tastes and preferences.
The IMPORTANT things about standards are:
You have some standards
They make some sense
You ADHERE to them
For the most part, I (read as you) can adapt to any standard or convention. But...
Dave is right..probably built by a code generator.
One comment though...The table alias on each column.
My company's code standard is to ALWAYS alias a table AND to ALWAYS include the table alias in each column definition.
Why when there is only one table in the query?
Because tomorrow you will...
Can you provide sample table schema, keys and a few sample records in each? Some expected output would help as well.
I believe you/we are missing some information in order to assist you. Your base table doesn't exist and doesn't really have a join to the derived query.
SELECT ID, NAME...
I'd start with the original value, then use SUBSTRING to get the correct value.
DECLARE @InputValues TABLE
(
DataValue VARCHAR(100)
);
INSERT INTO @InputValues
(DataValue)
VALUES
('1234567*AWD*2017/FA'),
('1234345*AWD2*2017/FA'),
('1234555*BDD09*2017/FA');
SELECT
iv.DataValue...
To expand on Andy's response, I believe the issue lies in your JOIN statements.
The emphasis you provided by stating that there were "(MULTIPLE VALUES FOR PROGRAM_ID)" indicates your JOIN statement will need more than one clause in order to match the records properly.
Andy is asking you to...
Thank you George. I wanted a single-query solution and couldn't "see" it. The concept of the DISTINCT Hours was my missing link. I like your solution.
Robert "Wizard" Johnson III
U.S. Military Vets MC
CSM, CSPO, MCPD, CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
Data Integration Engineer
While waiting for a version response, here is one possible solution for SQL 2012 or newer. I've added some comments, but please let me know if you need further explanation.
--Create a table variable to hold our test data.
DECLARE @Times TABLE
(
EmployeeId INT,
WeekNumber INT,
HoursWorked...
OK. Now the requirement makes sense logically so that we can come up with a solution. One more follow-up...what version of SQL are you using? It can make a difference in the solution.
Robert "Wizard" Johnson III
U.S. Military Vets MC
CSM, CSPO, MCPD, CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP...
So I go to work on a solution to assist you in this and either I am missing something or your requirements are overly complicated.
If the last 5 records Hours column for a particular employee match, the most recent Hours record is the value you want.
If the last 5 records Hours column for a...
Great read....just Great!
Robert "Wizard" Johnson III
U.S. Military Vets MC
CSM, CSPO, MCPD, CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
Data Integration Engineer
You should have something like (typed, not tested):
On Form_Appt_Main:
btnNew_OnClick()
{
var fan = New Form_Appt_New;
if (fan.OpenDialog() == DialogResult.Ok)
{
Datagrid.Refresh() //Whatever you use to load/reload the datagrid goes here
}
fan.Close()
}
On...
Try the below code. I found two issues with your attempt to make this code SQL-92 compliant.
The first is with one of the OUTER JOINs. You identified 'c.fkLocation =* l.pkLocation' as a LEFT JOIN and the operator (=*) listed is a RIGHT JOIN operatoer. I prefer to use LEFT JOIN only so I...
So my company has finally stepped up from a single SSRS 2008 R2 instance to a clustered SSRS 2014 set of servers. Woohoo! I don't know all the specs for the cluster.
I was given the cluster primary node name and am currently working through any changes needed due to the switchover. The most...
So I have a newer T-SQL developer in my company and I am code reviewing his first big set of work for me. The only real big thing I have found in his code is the constant use of the REMOTE hint when accessing linked servers. Sample queries provided below so you can see what I am referring to...
Is this a culture thing? A slang-speak, so to say? Maybe your speaker doesn't have a "professional" switch or thinks the audience is receptive to that usage.
In my professional community I wouldn't expect to hear that manner of speech, but outside of where I work I probably would - depending...
I always forgot to stress those points Andrzejek. Thanks for reminding everyone that its not always best to do something just because you can.
Robert "Wizard" Johnson III
U.S. Military Vets MC
CSM, CSPO, MCPD, CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
Senior Database Developer
You are diving more into DBA-type questions...Not programming questions. This is not my strongest area and I'd recommend you try the Microsoft SQL Server: Setup and Administration Forum (http://www.tek-tips.com/threadminder.cfm?pid=962).
Based on my limited DBA knowledge, you might be mixing a...
One quick follow-up. To filter the results to only show the table you are interested in, use:
DBCC SHOWCONTIG ('Schema.Table') WITH TABLERESULTS
As normal, Schema can be left off if the Table is located in the default Schema (usually dbo).
Robert "Wizard" Johnson III
U.S. Military Vets MC...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.