Who does SQL Server run xp_cmdshell command as?
When you execute xp_cmdshell SQL Server runs a command at the operating system level similar to the old DOS prompt, or CMD shell. There are… Read More »Who does SQL Server run xp_cmdshell command as?
When you execute xp_cmdshell SQL Server runs a command at the operating system level similar to the old DOS prompt, or CMD shell. There are… Read More »Who does SQL Server run xp_cmdshell command as?
To switch a database from simple to full recovery model, it is simple to do when you have one or two databases that need to… Read More »Switching multiple databases to FULL recovery model.
5 years at Stedman Solutions, LLC. Yes, it has been 5 years since I have been full time at Stedman Solutions. Check out my post… Read More »5 years full time at Stedman Solutions, LLC.
Occasionally I have come across the need to save the output from a query to a varchar value, for instance varchar(max). There are lots of ways to do this, could you use a cursor and just append to a string each loop through the cursor, but there is an easier way.
Examples of a need to do this would be to write the output to a file, or to build an email message that is going to be sent, or many other possible scenarios.
Lets start with a simple query on SQL Server 2019, grabbing a list of databases, and with a where clause to keep the list short for now.
--start with a simple query
SELECT *
FROM sys.databases
WHERE database_id < 9;
Which produces output something like this.

Now lets trim it down to just the data we want to build into string output.
Read More »Saving Query Output to a StringPosted 3/29/2020 — Edited 3/30/2020 to fix a couple of copy and paste errors, and to clarify a couple of items. Thanks Charlie for your… Read More »SQL Server – Writing to a File
Stedman Solutions, LLC is open for business during the Covid-19 pandemic and growing our team. This week the Stedman Solutions team grew by adding our… Read More »Stedman Solutions – Open for Business
SQL Server Alert System: ‘Severity 20 – Fatal Error In Current Process’DESCRIPTION: SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection… Read More »Severity 20 – Fatal Error
Is there any safe way to ‘update statistics’ without causing major slow downs? As far as a safe way to update statistics. It is best… Read More »Update Statistics
Database mail is a critical part of getting notifications from your SQL Server when things go wrong. The problem comes when you have a database… Read More »Bulk Update Database Mail Password
Part of good server monitoring it to have alerts enabled for a number of different errors to know when things go bad. The problem is… Read More »SQL Server Alert System: ‘ERROR 824’