Tag Archives: ms sql

moving ms sql server

we needed to move an sql server… so we looked for space in our virtual environment… there was… but wth? moving is renaming… or isnt it? first it looked like it was, but secondly there were a few problems…

basiclly the sql server instance has the same name as the server… wrong!

sp_dropserver ‘old_name’
GO
sp_addserver ‘new_name’, local
GO

this statements change the instance name… following command returns the current instancename…

select @@SERVERNAME

and thats the history of renaming ms sql servers… funny…

ms sql timeout

ok we had a problem on an application… it was really slow and sometimes it resulted in a sql timeout. so sql server(MSSQL 2008 R2) must be slow… no wasnt… network must be slow… no wasnt… app server must be slow… no wasnt… app must be slow… good point… but isnt…

after reading and debuging the sourcecode(code was not mine and coder is on vacation(as usual, when problems pop up…)) the slow sql statement was a view… running the view in the ms sql management studio: instant… hmm… wtf? after a few more tests we figured out, that the problem is based on the sql servers client, and a little bit of randomness…. running the statement on the sql server was instant… running it locally on a computer 23 seconds!.. running it on a virtual maschine, on the same computer… instant… wth? and always in ms sql management studio…

after a few more tries, we saw, that the result of the viw is unsorted… adding a “order by” resulted in the same process speed on all boxes… WTF? but yeah… its the damn solution…