Viewing 15 posts - 1 through 15 (of 22 total)
If you set it to single user mode and some process connects to it before you start the restore, you will find it very difficult to disconnect that user.
That is...
July 23, 2014 at 10:05 am
It is because invisible measures can still be used, if the measure name is known.
July 23, 2014 at 9:23 am
I don't drop it, because I want to keep the old db in case the restore fails 😉
Bringing it offline and online again to drop the connections is elegant.
July 23, 2014 at 9:21 am
You need to end (kill) all other user sessions connected to the db TEST:
declare users cursor
for select spid
...
July 23, 2014 at 8:56 am
Good that you are reluctant. If you don't really need to shrink, don't shrink! 15% does not sound like much. 🙂
If you really need to shrink and the database will...
July 11, 2014 at 8:29 am
This works, unless you use #temp table names with more than two subsequent underscores or ending with an underscore:
CREATE PROCEDURE [dbo].[dtt]
AS
-- drop all #temp tables for current session
begin
February 17, 2014 at 8:50 am
I just had to choose option 3 😀
Seriously, it would fail in my environment (SQL Server 2005) but work with newer versions as stated above.
February 11, 2014 at 2:15 am
sp_msforeachtable example:
sp_msforeachtable 'SELECT ''?'' AS ''table_name'',
CONVERT(VARCHAR, [_when], 112) AS ''_when'',
COUNT(*) AS ''records''
FROM ?
GROUP BY CONVERT(VARCHAR, [_when], 112)'
December 16, 2013 at 10:16 am
Please provide us with your code and sample data from both tables.
Just guessing from what you write, you left join table2 to table1 with the _Movement_ ID.
You will first need...
November 6, 2013 at 10:14 am
Use temporary tables to store the results and check if they return something before selecting from them
SELECT 1 Test INTO #t1
SELECT 2 Test INTO #t2
DELETE #t2 --now #t2 is empty
SELECT...
September 25, 2013 at 5:38 am
Nice! I had the same Problem, but was lazy - so all I did was this (in SSRS):
=Replace(Fields!DATA.Value, "><", ">"& vbcrlf &"<")
March 15, 2013 at 10:03 am
SELECT*FROM[sysobjects]ORDER BY 1desc
or even
EXEC('SELECT*FROM[sysobjects]ORDERBY1desc')
welcome to SQL golfing - omg LOL
The second thing is especialy bad, play with the order by to see why 😀
May 28, 2010 at 1:59 am
Gsquared your "ultimate version" is much fun to read!
Now you only need to tell Jeff that you always code like that 😛
February 22, 2010 at 9:27 am
No offence taken, Jeff. But you made me think about my habits, thanks for that 🙂
Being lazy and pragmatic is a very important developer attitude to me.
I never realized...
February 22, 2010 at 8:49 am
Yeah I know - i have rewritten quite a few poorly coded loops and cursors that performed badly.
It just takes me longer and is not the first solution that pops...
February 22, 2010 at 8:31 am
Viewing 15 posts - 1 through 15 (of 22 total)