Posts

Showing posts from December, 2025

Load CSV Data into SQL Server Database (Using SSMS)

Image
                              Import CSV into SQL Server Using SSMS Follow the steps below to import a CSV (Flat File) into your SQL Server database using SQL Server Management Studio (SSMS): Step 1: Open SQL Server Management Studio (SSMS) Launch SSMS. Connect to your SQL Server instance. Step 2: Select the Target Database In Object Explorer , expand the server. Expand Databases . Right-click the database where you want to import the CSV data. Step 3: Navigate to the Import Wizard Go to Tasks . Click Import Flat File… (This option allows importing .csv or .txt files easily.)   Step 4: Choose the File In the wizard window, click Browse . Select your CSV file Enter the name you want for the SQL table Keep as dbo unless you want a different schema Click Next . Step 5: Review Column...

TOP SQL SERVER SPATIAL FUNCTIONS

          ⭐ TOP SQL SERVER SPATIAL FUNCTIONS With Detailed Descriptions + Beginner Examples + Professional Use Cases ✅ 1️⃣ STDistance() — Measure Distance Between Two Locations 📘 Description STDistance() calculates how far one spatial object is from another. It works similar to the distance you see in Google Maps, but computed inside SQL. Using geography → distance in meters Using geometry → units depend on coordinate system 🌱 BEGINNER EXAMPLE DECLARE @a geography = geography::Point(17.385, 78.4867, 4326);   DECLARE @b geography = geography::Point(12.9716, 77.5946, 4326);   SELECT @a.STDistance(@b) AS DistanceInMeters; ✔ Output Distance between Hyderabad and Bengaluru in meters. 🧠 PROFESSIONAL EXAMPLE (Nearest Hospital Search) SELECT TOP 1     h.HospitalName,     p.PatientLocation.STDistance(h.Location) AS Distance FROM Hospitals h ORDER BY p.PatientL...

Export Data to Another Database (Using SQL Server Management Studio – SSMS)

Image
  Export Data to Another Database (Using SQL Server Management Studio – SSMS) Follow the steps below to export tables or data from one database to another using the Export Data Wizard in SSMS. We can use this to deploy tables from one server to another. Step 1: Open SQL Server Management Studio (SSMS) Connect to the SQL Server instance where your source database is located. Step 2: Select the Source Database In Object Explorer , expand the server. Expand Databases . Right-click the database you want to export data from . Step 3: Open the Export Wizard Go to Tasks . Click Export Data… (This opens the SQL Server Import and Export Wizard.) Step 4: Choose the Data Source The source database will be auto selected. Verify: Server Name Database Name Authentication Method (Username & Password) Click Next . Step 5: Choose Destinatio...