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
Question asked by Pramod on my old Forum.
I have decided to do away with my forum plugin, and instead have added the Ask a question/Contact Me page. All forum posts have been added as regular posts, with “Question:” at the start of the post title.
The example query below creates a product category table and populates it with sample data. I then use a CTE query to return the categories, along with the breadcrumb trail (lineage)