I use Emurasoft’s EmEditor as my preferred text editor, and wanted to find a way to identify non alphanumeric characters, including foreign characters. After a bit of Googling, I found a regular expression to find characters in a range. The regular expression below is used to find any characters betwen 0 and 127, which includes […]
Within the Master database:
CREATE LOGIN [username] WITH password=’password’;
Within the database itself:
CREATE USER [username] FROM LOGIN [username];
ALTER ROLE db_datareader ADD MEMBER [username];
Thanks to the post from Daniel Hutmacher ( https://sqlsunday.com/2018/06/12/right-align-columns-in-ssms/ ) I have found a great way to right-align numeric values in SQL Server Management Studio when viewing results in a grid.
I wanted to look for all non-standard (i.e. A-Z/a-z/0-9) characters in a field across all records in a table. Therefore, I have adjusted my previous script to do so: Simply change to the required database, and change the select statement in the cursor. Please always test on a development server/database before running on Production.
I wanted to add leading zeroes to a number column, making a seven-digit number. I found the REPT function:
If the cell is longer than 7 digits, it puts the whole cell value in. If it is 7 or less, it will “repeat” the zero the required number of times.
Hope this helps 🙂
I recently updated all of the NuGet packages in one of my solutions, and it seemed to break the CSS.
I recreated the project and copied the model, controller and views across to the new project. I then updated the NuGet packages one by one, and when I updated to Bootstrap 4.0.0 (or later) it broke!
When I downgraded to 3.3.7 it all came back again 🙂
Therefore, it is probably outdated code in the MVC template in Visual Studio that causes the new bootstrap to break it.
Hopefully this will help other people having the same issue
New script to return the number of records in all tables in a specific list of databases.
I have only just found out about the “MERGE” transact-SQL statement that was introduced in SQL Server 2008.
“Performs insert, update, or delete operations on a target table based on the results of a join with a source table. For example, you can synchronize two tables by inserting, updating, or deleting rows in one table based on differences found in the other table.”
Script to retrieve a list of databases with the associated recovery model. Useful for checking backups.
I was having problems with SSMS (SQL Server Management Studio) which I have been running with administrator permissions, whereby I couldn’t open files on my mapped network drives.
Doing a bit of Google’ing, I came across this article – https://technet.microsoft.com/en-us/library/ee844140(v=WS.10).aspx
I have developed a script that can be used to archive offline databases. This script first brings the databases online, then backs them up, detaches them, and then moves the MDF and LDF files.
I have just improved the script in SQL: List of table columns, with data types:
It now includes an indicate for nullable fields, primary and foreign keys, unique and check constraints, and identity columns