Quantcast
Channel: Working With Data – Sql And Me
Browsing all 24 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Exporting data to CSV file using SQLCMD/BCP

When it comes to exporting data there are different options available in SQL Server, such as SQL Server Integration Services, Generating Insert Scripts, BCP, Import and Export Wizard and SQLCMD. When...

View Article



Image may be NSFW.
Clik here to view.

Importing data from Excel – using INSERT statements

You can easily import data from an Excel file to SQL Server using SQL Server Import and Export Wizard. However, when the data is simple and limited I avoid using it (too lazy to click through 6...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – DDL vs. DML Triggers

Although, DML and DDL triggers are used for different purposes, there are some similarities and differences between these.   Similarities between DDL and DML triggers: 1. Both are created using similar...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – How to Rename Table/Column in SQL Server

To rename an object in SQL Server you can use sp_rename system stored procedure or you can do this via Object Explorer in SQL Server Management Studio. Method 1: To rename an object using SQL Server...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – Saving Changes Not Permitted in Management Studio

SQL Server Management Studio does not allow you to save changes to a table which require table re-creation such as changing data type for a column. When you perform such changes you will run into...

View Article


Image may be NSFW.
Clik here to view.

SQL Server – Add Date/Time to output file of BCP / SQLCMD

You can export data from SQL Server using BCP command for SQLCMD utility. However, these utilities does not support dynamic file names when exporting data. For generating dynamic file names you can use...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – Add Date/Time to output file of BCP / SQLCMD (2)

Last time I posted about How you can add date/time to output file name, in which I used xp_cmdshell to execute the BCP/SQLCMD command using TSQL, which means we need to have xp_cmdshell server feature...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – Import Data from Excel using T-SQL

To import data from an Excel file to SQL Server you can use SQL Server Import and Export Wizard. You can also import Excel data using T-SQL OPENROWSET function. OPENROWSET function can be used to...

View Article


Image may be NSFW.
Clik here to view.

SQL Server – How to Move Table to Another Schema

Starting with SQL Server 2005 all tables are grouped into schemas. While creating a table if the schema name is not specified it is created in the default schema of the user creating it. you can use...

View Article


Image may be NSFW.
Clik here to view.

SQL Server – Update Table with INNER JOIN

Often we may need to update a column in a table based of another column in another table. In SQL Server you can do this using UPDATE statement by joining tables together. To understand this better...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – SELECTing/Displaying Top N rows from a table

To SELECT only top N rows from a table we can use TOP clause in SELECT statement. Using TOP clause we can also specify percentage option. For example, both of these statements are valid: USESqlAndMe GO...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – Import text file using xp_cmdshell

There are several options available to import data from external sources to SQL Server. Such as Import & Export Wizard, BULK INSERT command, SSIS and OPENROWSET. Apart from this options you can...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – Custom sorting in ORDER BY clause

ORDER BY clause can be used to sort the results returned by SELECT statement in SQL Server. It orders the result set by specified column list. When used with character data type columns it sorts data...

View Article


Image may be NSFW.
Clik here to view.

SQL Server – Calculating elapsed time from DATETIME

Elapsed time can be calculated from DATETIME field by extracting number of hours/minutes and seconds. You can use below query to calculate elapsed time between two dates: -- Vishal -...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – Saving Changes Not Permitted in Management Studio

SQL Server Management Studio does not allow you to save changes to a table which require table re-creation such as changing data type for a column. When you perform such changes you will run into...

View Article


Image may be NSFW.
Clik here to view.

SQL Server – Add Date/Time to output file of BCP / SQLCMD

You can export data from SQL Server using BCP command for SQLCMD utility. However, these utilities does not support dynamic file names when exporting data. For generating dynamic file names you can use...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – Add Date/Time to output file of BCP / SQLCMD (2)

Last time I posted about How you can add date/time to output file name, in which I used xp_cmdshell to execute the BCP/SQLCMD command using TSQL, which means we need to have xp_cmdshell server feature...

View Article


Image may be NSFW.
Clik here to view.

SQL Server – Import Data from Excel using T-SQL

To import data from an Excel file to SQL Server you can use SQL Server Import and Export Wizard. You can also import Excel data using T-SQL OPENROWSET function. OPENROWSET function can be used to...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – How to Move Table to Another Schema

Starting with SQL Server 2005 all tables are grouped into schemas. While creating a table if the schema name is not specified it is created in the default schema of the user creating it. you can use...

View Article

Image may be NSFW.
Clik here to view.

SQL Server – Update Table with INNER JOIN

Often we may need to update a column in a table based of another column in another table. In SQL Server you can do this using UPDATE statement by joining tables together. To understand this better...

View Article
Browsing all 24 articles
Browse latest View live




Latest Images