Prerequisites:
- MSSQL 2005
- AdventureWorks DW
Steps:
1. Enable xp_cmdshell on the SQL instance
- Start > Programs > Microsoft SQL Server 2005 > Configuration Tools > SQL Server 2005 Surface Area Configuration
- Surface Area Configuration for Features > MSSQLSERVER > Database Engine > xp_cmdshell
- Enable xp_cmdshell: Check
2. Prepare your query
- Start > Programs > Microsoft SQL Server 2005 Management Studio
- New Query
3. Execute your query using BCP
- Start, Run, CMD
- Change Directory: C:\Program Files\Microsoft SQL Server\90\Tools\Binn
- bcp "select firstname, lastname from dbo.dimcustomer" queryout c:\awdwcustomer.txt -T -C RAW -t ","
4. Review your output
- C:\awdwcustomer.txt
e.g.
Jon,Yang
Eugene,Huang
Ruben,Torres
Christy,Zhu
Elizabeth,Johnson
Julio,Ruiz
Janet,Alvarez
Marco,Mehta
Subscribe to:
Post Comments (Atom)
Events / Conferences / User Groups
- AIIM Conference
- Boston Area SharePoint User Group
- Boston Azure User Group
- Collaborate
- DevConnections
- DevIntersection
- Enterprise Search Summit
- Microsoft Build
- Microsoft SharePoint Conference
- Microsoft TechEd
- New England ASP.NET Professionals User Group
- New England Oracle Applications User Group
- Oracle Applications User Group (OAUG)
- Oracle OpenWorld
- PeopleSoft Government Contractor Special Interest Group
- PeopleSoft Southern New England Users Group
- Quest International Users Group
- SharePoint Saturday
- SPTechCon
- SQL PASS
- SQL Saturday
- Startup Weekend
1 comment:
Getting error SQLState = S0002, NativeError = 208 that is Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'tablename'. in SQL 2005.
Can you please help?
Thanks in advance.
Post a Comment