@MeNoTalk I think it's just 16. minimum and maximum. 2 bytes for each character.
@ShawnMelton Yeah. But Microsoft's policy to use Azure in naming 2 (or 3?) similar but different things doesn't help anyone. As obvious by the comments needed to clear what they were referring to.
It says here that ORA-00942 is also returned when you don't have enough privileges, although I'm not sure why you wouldn't have desc privileges on an object you created yourself.
@JNK, @Lamak, @AndriyM, @MeNoTalk Just to confuse matters a bit. From SQL Server 2012 you can use UTF-16 collations by selecting a collation named something "_sc" and those can use up to 4 bytes. msdn.microsoft.com/en-us/library/…
Problem
I have a SQL statement with an LEFT OUTER JOIN which works fine on our Microsoft SQL Server. My problem is that i have to be compatible with H2 Database and this one got a bug with OUTER JOINS.
SQL Query
SELECT *
FROM tSysNls
WHERE nlsGuid IN
( SELECT nlsGuid = CASE
WHEN de_...
@JNK Why would you have a table where all the columns are nvarchar, there is no pk and one that looks like a pk is nlsGUID nvarchar(207). 414 bytes (or 828 if they are fans of utf-16 :)
Don't understand Remus' attitude about instead of triggers
I don't understand your objection to instead of triggers. In cases where you will have a high rate of failure, you would rather write to a table then roll it back, with all the additional costs involved, than not do anything at all? I certainly agree that the OP's problem is not an ideal use case, but that doesn't mean there are zero use cases - even if you don't count the use case with views. — Aaron Bertrand ♦4 mins ago
@ypercube yeah, I suppose it depends on the three fields involved in the "JOIN" being defined as "NOT NULL". Or do you have some other thing I didn't think of?
It is after all, monday morning, and I've only had a single coffee. :-)
@MaxVernon Too complicated to have a definite opinion. But the nulls checked in the original query are produced by the outer joins. Your query seems to check existing in the tables nulls. Doesn't seem right.
Declarative integrity is always better than a trigger. An after trigger is always better than an instead of trigger. Instead-of triggers have 'funky' behavior in a lot of situations, they are opaque to access path optimizations in DML, they make isolation levels behave erratic. Instead-of triggers scream 'I should had been an access stored procedure instead'. And I don't buy the 'do the work twice' argument at all, optimizing the exception path should not influence the design, specially at the cost of the slowing the frequent path. — Remus RusanuJun 7 '12 at 7:32
That seems to be the bulk of his reasoning. My quoting him doesn't mean I agree 100% with what he says.
INSTEAD OF was primarily added (I think) to support custom logic for updatable views, where they wouldn't normally be so. Also Oracle supports them, and/or BEFORE triggers something something.
BEFORE trigger would be a lot more useful. Especially for DDL (which doesn't have before or instead of - create an index that takes 12 hours then roll it back because it violated naming scheme - awesome!)
@AaronBertrand Retail is not a high-margin enterprise. Every $ counts when you have tens of thousands of these things out there in various states of repair and in various places in a busy retail environment with no on-site tech people.
TL;DR I was aware of the alternatives and auto shrink was the way that worked best for us.
Naturally. For me, in those specific circumstances, it was the best choice. I doubt it is a very common scenario these days, given modern-ish hardware etc.
People use cursors all the time when 99% of the time there are better answers - all comes down to how much time and brains you can invest in writing it better and refactoring.
Many to many tables usually have only foreign keys to related tables, like
EmployeeId
PositionId
Is it good idea to add column only for partitioning and set its value with INSTEAD OF INSERT/UPDATE trigger from one of the related tables that has such a column?
Well this was also quite a number of years ago. The big problem, IIRC, was that the local hard disk was indeed extremely small (~10GB). It just was not possible to configure the database files at peak size, because then the one-a-week bulk-SKU-price changes would fail. Anyway, there were lots of considerations, specific to the precise business and technology involved.
Even Microsoft (90K employees) couldn't possibly see a ton of benefit from partitioning a table with two ints.
@PaulWhite But if the database needed to auto-shrink after that bulk process was done, isn't it possible that the bulk process itself could have caused the database to try to grow beyond the capacity of the drive?
If a customer brought that problem to me today, and hardware wasn't an option, I would probably have looked into ways to make that process less impactful (bulk in chunks with commits/log backups/checkpoints in between).
@AaronBertrand There were many such processes, I am simplifying of course. And many reasons for the database to grow, not just bulk-change processing. The POS was also a commercial package, with limited scope for e.g. chunking bulk ops. Trust me when I say I considered these options.
I obviously don't know all of the specifics in your scenario and what other variables you were dealing with at the time. I do accept that 10 years ago auto-shrink was probably a much more attractive option than it is today.
I can't think of a scenario where I would enable auto-shrink today, in production.
But that equally doesn't mean there isn't some $multi-billion business out there that wouldn't fall over immediately if the option were removed from the product.
@PaulWhite Oh certainly, I'm not advocating for its removal (at least not in this conversation). Was just saying that a feature's existence does not necessarily mean it's because there are good use cases.
Auto-close, for example - I would never let a customer use that, either, but there are some use cases (e.g. budget shared database hosting with no SLAs)
My favorite cooking horror story features my old coworker and his wife. They had plenty of escapades - like the cling wrap has fallen from the top shelf more than once and the sharp side lacerates her arm resulting in ER visits
This one though, this one took the cake.
His parents were coming over and she was all nervous about everything being just right, getting flustered about the whatever in the over not turning out right
No, there is no reason why any sane person would use a CROSS JOIN here. CROSS JOIN implies that you want a Cartesian product - while it is possible to coerce it to behave like an INNER JOIN with additional filters, I don't see the point. When you want an INNER JOIN, use INNER JOIN; when you want a CROSS JOIN, use CROSS JOIN. Regardless of what the open source documentation says. I can ride my tricycle on a lot of highways where non-motorized vehicles aren't explicitly forbidden, but that doesn't mean it is sane or logical to do so. — Aaron Bertrand12 secs ago
+1. The only "sane" reason that someone would replace the keyword "INNER" with "CROSS" in the OP example is that they were using MySQL, and they are aware that in MySQL "JOIN", "INNER JOIN" and "CROSS JOIN" are synonymous. — spencer75931 min ago
there is some possible solution for that:
method one: using MDF repair tool http://www.mdfrepair.com/
method two: if you have the corrupted DB then:
1)shutdown SQL server
2)move the files to another location or rename it
3) start SQL server again
4) create a new DB with the same info (databa...
> “Now everything you heard is why I, the actual owner of the Alaska Cannabis Club, will be dedicating all of my energy for fighting for freedom and fairness which begins with legalizing marijuana here in Alaska," she said. "And as for this job, well, not that I have a choice but, fuck it, I quit.”
Previously, i asked for help in using pivot. I was able to create a query without using the pivot. Now i have a problem, when i run my query i am getting an error "Cannot create a row of size 10422 which is greater than the allowable maximum row size of 8060.". Please find the table structure an...
It might be device specific too, this is an iPhone 6, maybe they have trouble with the different screen size or some underlying technical thingamabobber
Never tried any 3rd party keyboards before this phone.
I'd like to know please which code to use in order to convert a string variable whose format is 'dd/MM/yyyy hh24:mm:ss' into datetime type :
declare @var as char(19);
set @var = '22/09/2014 16:30:20';
select CONVERT(DATETIME, @var, ?);
Also i'm wondering whether there are any other ways to con...
we have a process that needs to take a production backup and then attach it to a different server weekly - for reporting needs. Should we drop the existing DB on the reporting server or restore with replace?
@bluefeet Restore with replace avoids the overhead of creating the database files. Non-log files can be IFIed but there's still an overhead, and logs have to be zeroed, IIRC.
I must perform this operation under oracle 9 and sql server 9
I have on table with images inside and it can be quite heavy.
I want to select the ten first rows then the ten next etc... until the end of the table.
If possible I would like to have the same request to do that for oracle and sql ser...
And if you have half-decent I/O and/or this is an overnight process for a reporting system that is only used during the day, I'd rather focus on the FTP issue that is making the restore corrupt than muss with the existing restore process.
No, it's a good point, however I recall that being less beneficial in my case because the data file sizes did fluctuate drastically (in both directions) due to the nature of the app (databases were re-purposed and right-sized). I'm just reflecting what I would do currently.
@billinkc I use a combination of shellrunas with keepass
@billinkc shellrunas adds an entry on the context menu to prompt for credentials, and you can configure keepass to do automated entry of credentials using a keybind
@billinkc so I would just right click SSMS or Excel, f.e., and then press Ctrl+Alt+A, and it fills it in for me. It's pretty cool, because you can keep a lot of credentials encrypted, so you don't have to have one .bat file per app per customer
@billinkc No problem! Thought I would share since I'm really happy with the solution :-)
It's a bummer not being in the domain with SSDT-BI... even if you run it with shellrunas or runas /netonly, SSAS deployment process is spawned without the domain credentials context, so you have to run the deployment wizard separately
same thing for previews of SSRS, although for that one you have a workaround
It's really weird, but instead of the preview, if you right-click the report and select "Render" (or view or something, I forget the name of the option), a window pops up and it renders the report with the domain credentials
@PaulWhite, I was reading your answer about MERGEing a table subset (dba.stackexchange.com/a/30653/4134) and you mention that there's problems as well with the CTE approach, have you blogged about this somewhere else?
@Gonsalu anything external - I don't think most of those really require the complexity of SSIS, all depends on your expertise. Active Directory surely not.
Can executing an SSIS package be made asynchronous from inside a SQL Server job, trigger, procedure, etc.? I'm not even sure. And would you still need xp_cmdshell in some of those cases?
@AaronBertrand Yeah, it can run asynch. No, in SQL Server Agent you get a specific option to run SSIS packages, so you don't need xp_cmdshell. You need to define accounts if you want to run it under isolated credentials, tho...
@AaronBertrand I have some cases where I have to get the list of users that belong to an AD group, to materialize many-to-many tables to support SSAS dynamic security. I usually create a linked server to get the user membership information, but I'm not sure if it's the best solution
With 2012 and the project deployment model, they build the CLR methods into the catalog so you can just run a package from SSMS without needing to shell out to xp_cmdshell and then hitting dtexec. It's all a matter of whether you specify the sync/asynch parameter
If someone's heavily invested in their current process for auditing, logging, configuration etc, then I suppose package deployment model makes sense but the integrated management with the SSISDB is awfully compelling to me. As an admin, I would think they'd also be pushing for it
@AaronBertrand using SSIS with script tasks, I guess? I can't think of more options... I try to avoid script tasks, so that's I opted for the linked server instead
@billinkc yeah, that's my line of thinking as well
The 2012 release of SQL Server Integration Services, SSIS, has delivered an SSISDB catalog which tracks the operations of packages (among other things). The default package execution for solutions using the Project Deployment model will have logging to the SSISDB turned on.
When a package execu...
We stored the execution id in our audit tables to be able to relate what we cared about (insert/update counts & package duration) to specific executions. That way, "our 100 row insert rand like crap, why?" look at the catalog for the same time frame and discover someone else has launched packages.
That was the theory at least. The heavy, concurrent workload never materialized
the reason I'm asking is because at my current project, I'm just storing that execution id, but I'm afraid that the SSIS clean up will get rid of some execution information, and I'll lose the ability to know that execution id 1234 was from an execution that ran 2 years ago or something
It's not too important for the project, but I'd like to know what I'm dealing with :-)
Hadn't thought about that. The 2012 client is about 3 months out before they'd start getting log data archived out. I think my assumption is that I don't much care about looking for trends that far out but that would change depending on actual needs