Narinder Singh

Narinder Singh

  • 1.6k
  • 114
  • 9.6k

Export data Sql to Excel

Aug 18 2018 12:12 AM
i try to export whole data from sql to excel, but am not acess, following is command and message:- 
 
Command:- EXEC xp_cmdshell 'bcp "select top(1) * from dbname.dbo.tblname" queryout "D:\file.txt" -U myid -P currentpwd –S abc\sqlexpress -c -t,'
 
 
 
 
 Message is:-
SQLState = 08001, NativeError = 87
Error = [Microsoft][SQL Server Native Client 10.0]SQL Server Network Interfaces: Connection string is not valid [87].
SQLState = 08001, NativeError = 87
Error = [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is config
ured to allow remote connections. For more information see SQL Server Books Online.
SQLState = S1T00, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Login timeout expired
NULL
 

Answers (3)