sql

How to add test data for the development and tests in EF Core

There’s a nice online tool for rendering the test data. It’s at the website https://www.mockaroo.com/. I often use it to render fake SQL data. But now I am working on a Net application with EF Core. And obviously, I need test data for webservices and interfaces. Below is the way to quickly insert the test […] Read more»

.Net & C#

T-SQL tips: Replace function example

In the developer database (MS SQL Server) I had a field, in which all the values were the same. The value was “OldDoc.txt”. I wanted to make values unique and for this I wanted to add “ID” before “.txt”. Read more»

SQL and databases

Backup MSSQL database with compression

To create a full backup of MS SQL Server database with compression use this SQL command: use YourDataBaseName go BACKUP DATABASE YourDataBaseName TO DISK = 'Z:\BACKUP_FILE_NAME.bak' WITH COMPRESSION According to database size and your server capabilities, backup time can vary.   Read more»

SQL and databases

3 ways to find out if the column in table exists

There are at least 3 ways to find out if the column in table exists in MS SQL server. It’s a common task for developers or administrators when you need to modify table. Read more»

SQL and databases

Get data and stats about files in document libraries in SharePoint site from SQL Server

SharePoint 2016 Logo

Information about files in document libraries is strored in the table “AllDocs” of Site’s content database. Of course, Microsoft doesn’t allow to make queries to SharePoint databases directly. But I can’t but agree with inserts and updates are not allowed, but select query in the worst case will make just some locks in database. So […] Read more»

SharePoint

Get records with empty binary items

There’s a column Photo with type “Image” in MS SQL table (database – MS SQL Server 2008 R2). The task is to get all the records where Photo is empty. Values of empty images is “0x00000000”. Read more»

SQL and databases

Queries for a Sybase Administrator

While integration with Sybase server, I had to study some queries. When me and Sybase administrator couldn’t understand the reason of error, we have started to look for missed procedures or tables. So, when I had to use some queries to look for tables, view, stored procedures etc. Read more»

SQL and databases

Count rows in result of SQL query

To receive quantity of rows of the returned records of SQL query, you should use function @@ROWCOUNT. Function @@ROWCOUNT returns the quantity of rows, which were used in a query. Read more»

SQL and databases

Code examples: Get date minus 1 day

Source: A date in string format, for example, “2015-04-21”. The task: To find a date minus 1 day from the source. Solution: Read more»

.Net & C#

Popular Posts