@FreshPrinceOfSO I'm not sure I understand the question? Are you asking if it is an election, or if there is exactly 4, or if there are 4 slots open, or...?
The general idea is we pass in 4 parameters and it checks a bunch of criteria and returns a list of errors if there are any
could be 0-10 errors for each set of params, lets say
@FreshPrinceOfSO yeah poor grammar is a giveaway
so I was directed to use a UDF to consolidate the code for the checks
I was opposed to it but the trigger is on a very low volume table so here we are
I was also told I should have the UDF return a distinct list of errors
and I'm not sure how I can do this in the case of the trigger, when I need to run it against the entire inserted table
The only thing I can think of is to make the UDF return a table of all the errors, and then the trigger will build a mega-table that it keeps inserting into and then runs a distinct on
but the idea of doing that inside a trigger makes me throw up in my mouth a little
@JNK well, yeah, but you can make an inline table-valued function and then cross apply against inserted. That wouldn't be quite as bas as a scalar UDF against every row. As you said it's low volume so the different will be negligible anyway.
I purposely did that with concatenation. Your description of your existing UDF is way, way, way too vague for me to know exactly what you're actually trying to do.
Also note that in my fiddle the error conditions are not mutually exclusive - look at the first row of the output, it met two conditions (just not obvious because my concatenation doesn't use a visual separator).
He said something along the lines of "some people would have a fit if they heard me talking about fields to you, but life's too short and aint nobody got time for that"
Well, the problem is, bad semantics lead to incorrect perceptions. It doesn't take all that much effort to consciously swap out two words, especially if your perception is that they're interchangeable.
And when you know people have a fit when you use the wrong word. Then again, maybe that's where he gets his jollies.
When I run the following query I get the above error. I realize this is because the subquery is returning more than 1 result but am not sure how to fix it.
update a
set a.covtypeplus = (SELECT distinct
REPLACE(REPLACE(ISNULL([BI],'x') + '+' + ISNULL([PD],'x') + '+' +
...
In database terminology:
What is the difference between a row and a record?
Likewise, aren't columns and fields the same thing?
On the blog Joe Celko The SQL Apprentice , I noticed that the banner mentions that they are different things.
@AaronBertrand hahahahahaha. active/active active/passive is a fun one to say ... but then when you get serious and say "multi-instance failover cluster" some people look at you all googly-eyed. then you have to fall back to a/a.
@FreshPrinceOfSO no, consider that regular indexes can be reorganized online, but not rebuilt online (meaning people wait) unless Enterprise and the online option is set. Before 2012 this was not possible even in Enterprise if there are LOB columns. I think there are similar restrictions on fulltext but I'm not 100% sure how different they are.
@FreshPrinceOfSO in standard edition etc., yes, queries will be blocked. Like I said, though, I don't know if that's true for full-text (but I assume it is).
I'm just excited that we are getting another mod.....all results are good ones. If @bluefeet gets elected we got a good mod, awesome PIVOT skills. If @AaronBertrand wins, we get another good mod, and we can test how much his patience last. It's a win-win situation
Ha ha. Again, I don't think my patience on this site is going to be much of an issue, because of the quality difference. Now, I nominated myself to become a mod so I could help keep it that way.
I'm trying to UPDATE values in an Oracle database table (of salary information) that has no row IDs or a primary key.
This syntax should work just fine in T-SQL:
UPDATE schedule_amounts
SET ANNUAL_RATE = 44000
WHERE SCHEDULE_ID = 'LCSD'
and SCHEDULE_NO = 2014
and SCHEDULE_LEVEL = 100
and...
Deleting your own question will count against you to some degree. I think the question can be salvaged, if you explain that you were using LinqPad, remove the "doesn't like it" bit and list the actual error message, verbatim, and then post an answer describing exactly how you fixed or worked around the issue. A future user may come across the same issue in LinqPad. — Aaron Bertrand14 secs ago
@swasheck Yup, 13 hours of pay for last night (had a 90-minute gap in the middle where I don't get paid because I wasn't working) + working today is all double time.
In my view Windows Authentication is still more secure. Just.
With windows authentication you can allow a group of people (via a Windows Group) to have access to the database. Only those users can use an application, any application, to connect to the database.
If you use a SQL Server account...