Blog

Alternative of DBCC CHECKDB Repair Allow Data Loss

DBCC CHECKDB is executed on the SQL Server database to check the physical and logical integrity of the databaseโ€™s integral components. These objects include tables, indexes, keys, stored procedures, triggers, etc. DBCC CHECKDB also checks the structure of all the database tables and indexes. In case any of these checks fail while executing DBCC, youโ€ฆ

USE of GO in SQL Server

GO is interpreted by SQL Server utilities as a signal to deliver the current batch of Transact-SQL statements to a SQL Server instance. All statements entered since the last GO, or since the beginning of the ad hoc session or script if this is the first GO, make up the current batch of statements. Toโ€ฆ

Can we convert TIMESTAMP to date time?

The short answer is, NO. Let’s consider the following example. USE testDB GO CREATE TABLE tbOrders ( iOrderID INT IDENTITY(1,1) PRIMARY KEY, dtOrderDate DATETIME, dcPaidAmount Decimal(9,2), TIMESTAMP ); INSERT INTO tbOrders(dtOrderDate, dcPaidAmount) VALUES (‘2023-11-01’, 2750), (‘2023-11-02’, 3950), (‘2023-11-03’, 7000); Now retrieve the data and see the results. SELECT * FROM tbOrders The timestamp values assignedโ€ฆ

Stored Procedure – RAISERROR

Here’s an example of how to make a user-defined error message and raise it in the event that something goes wrong. — Creating the procedure CREATE PROCEDURE uspUpdateValue AS BEGIN TRY DECLARE @ErrorMsg VARCHAR(100) DECLARE @ErrorMessage VARCHAR(100) DECLARE @Severity INT DECLARE @State INT SET @Severity = 10 SET @State = 1 SET @ErrorMessage = ‘Anโ€ฆ

MySQLDump Backup and Restore All Databases at once

The mysqldump client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data. It dumps one or more MySQL databases for backup or transfer to another server. The mysqldump command can also generate output in CSV, other delimited text, or XMLโ€ฆ

Assign a serial number to result set – MySQL

Concerned parties may occasionally request that a serial number be displayed alongside the result set when a report is being generated. If the table lacks an auto-increment column or the result-set is lacking a unique identifier, you can assign one dynamically using the method outlined below. — Sample datasetCREATE TABLE tbCustomer (ย ย ย  CustName VARCHAR(45) NOTโ€ฆ

Generate SubOrder ID to Orders MySQL

To differentiate between OrderIDs that are identical, it is suggested to include a SubOrderID as an additional field with a serial number suffix. For example, in the event that the OrderID is 100123 and is repeated twice, the SubOrderID values in the additional column should be 1001231 and 1001232. — Sample dataset CREATE TABLE tbOrders(โ€ฆ

Anonymity with Random Values in MySQL

Organisations can use data anonymization as a strategy to abide by strict data privacy rules that require the protection of personally identifiable information (PII), such as date of births, emails, identification details, monetary information, contact information, and information from health reports. The following will assist in making the data anonymous. 1) Updating random values forโ€ฆ

SQL Sample Datasets and Assignments

Here is a compilation of earlier blog posts that were relevant to Sample datasets, Sample projects, and Sample assignments. For quick reference only. ย 

Something went wrong. Please refresh the page and/or try again.


Follow My Blog

Get new content delivered directly to your inbox.