Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
Your profile
Tag cloud
book bug business intelligence database dates dmv functions gemini gotcha how to howto indexing interview madison performance performance tuning postgresql programming sql sql friday sql server sql server 2000 sql server 2005 sql server 2008 sql server 2008 r2 sqlserver t-sql tip trick xml
Authors
- SQLDenis (166)

- onpnt (86)

- George Mastros (32)

- chrissie1 (8)

- naomi (7)

- emtucifor (6)

- Alex Ullrich (6)

- thirster42 (4)

- ramireddyindia (2)

- riverguy (1)

- tarwn (1)

- pmch22 (1)

- More...
Main Categories
Search
Google Ads
Tags: openrowset
Sometimes you want to quickly copy some data into a text file or you want append some data to a text file but you don't feel like opening BIDS or the DTS designer. Here is a way to accomplish what you want from within a query window
To copy data into a new file use BCP (Bulk Copy Program). To append to a file use OPENROWSET
Here is some sample code. First create this table
If you try to execute xp_cmdshell on a fresh install of SQL Server 2005 or 2008 you will be greeted with the following message
Server: Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1
SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.
...
Create an excel sheet
In the first 2 rows put some data, save the excel sheet as testing.xls on the c drive
Execute the command below


LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.