Viewing 15 posts - 256 through 270 (of 7,191 total)
Not sure I understand the problem fully, but is as simple as this? (I've done this from memory - forgive me if the syntax isn't 100%.)
USE MYDatabase;
IF...
December 23, 2019 at 3:33 pm
Yes, I meant to mention that performance would be horrible. You do realise you're going to get false matches the way you've ended up doing it? For example, 3045 would...
December 23, 2019 at 12:00 pm
It looks as if tbl1 pads out the account numbers so that they're all the same length, by inserting 0s before the fourth to last digit. If I'm right, you...
December 23, 2019 at 11:18 am
If you're only interested in connections, rather than what they're actually doing, then you only need to capture login events. If your position is that nobody is connecting, but you...
December 20, 2019 at 1:53 pm
This *was* good advice back in 2005, but now on SQL Server 2012 and above, table variables can be indexed, are dynamically indexed by default and fully accessible by...
December 20, 2019 at 11:57 am
Thanks Jeff. I have now submitted my first ever Question of the Day!
John
December 20, 2019 at 11:42 am
If you need to do the import over and over then consider writing it using bcp or BULK INSERT. If you really prefer to use the GUI then follow
December 20, 2019 at 10:38 am
You need to build your SQL string dynamically, as you have done, and then pass it to sp_executesql, which should not be part of the dynamic SQL. Here's some pseudo-code:
December 20, 2019 at 10:20 am
One thing I noticed is that the AND A.fpe_start_date >= ph.start_date line will turn your LEFT JOIN into an INNER JOIN. I think you need that to be in your...
December 19, 2019 at 3:29 pm
If you could provide the table DDL and sample data in consumable format, it would be easier for us to help you.
What have you already tried? Is it as simple...
December 19, 2019 at 12:52 pm
Will this go away if I got back to exec(@sql) use the temp table method?
No, because, as the error message implies, you can't have dynamic SQL in a function. ...
December 19, 2019 at 10:53 am
It's still almost impossible to read if you put it all on one or two lines. Try something like this (the only thing I've changed is the layout):
December 19, 2019 at 9:44 am
I use this query to capture recent deadlocks. If you run it in SSMS and click on the DeadlockGraph field, the XML will open in a separate window and you'll...
December 19, 2019 at 9:38 am
You could insert the result of the EXEC statement into a temp table and set the value of @result from there. What I recommend you do, though, is use sp_executesql...
December 19, 2019 at 9:27 am
I recommend that you lay out your code to make it readable. You'll find it much easier to spot errors that way. I think what you need is a ")"...
December 19, 2019 at 9:21 am
Viewing 15 posts - 256 through 270 (of 7,191 total)