Help BCP The Following Query

Reply

Join Date: Mar 2007
Posts: 158
Reputation: vuyiswamb is an unknown quantity at this point 
Solved Threads: 5
vuyiswamb's Avatar
vuyiswamb vuyiswamb is offline Offline
Junior Poster

Help BCP The Following Query

 
0
  #1
Nov 2nd, 2009
Good Day All

I have the Following Query
  1. DECLARE @CurrentTime DATETIME
  2. SET @CurrentTime = CURRENT_TIMESTAMP
  3. SELECT tr.Descr [Room], tb.Purpose [Purpose], tb.Description [Description],
  4. convert(varchar,datepart(hour,tb.starttime))+':'+convert(varchar,datepart(minute,tb.starttime)) [Start Time],
  5. convert(varchar,datepart(hour,tb.endtime))+':'+convert(varchar,datepart(minute,tb.endtime)) [End Time],
  6. tu.name [Requested BY] FROM tbl_booking tb INNER JOIN tbl_resource tr
  7. ON tb.resources = tr.id
  8. INNER JOIN tbl_user tu ON tu.id = tb.RequestedByUser
  9. WHERE (day(startdate) = day(@CurrentTime))AND(month(startdate)=month(@CurrentTime))AND(year(startdate)=year(@CurrentTime))AND(tb.STATUS=1)
  10. ORDER BY [Room],[Start Time]
  11. FOR xml raw

This creates an XML, but now i want to store it in
C:\X.XML
how can i BCP this Query

Thanks
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,473
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 630
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast
 
0
  #2
Nov 2nd, 2009
Why don't you handle this task at the application layer instead of the DB layer? Often time the MSSQL Service is not running with administrative rights and does not have filesystem access to the root drive of the disk, ie C:\
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 158
Reputation: vuyiswamb is an unknown quantity at this point 
Solved Threads: 5
vuyiswamb's Avatar
vuyiswamb vuyiswamb is offline Offline
Junior Poster
 
0
  #3
Nov 3rd, 2009
Good Morning

This is not an Application, so i will not have a BLL or DAL. i have all the Rights to write to the File System. all i need is help to BCP the given query
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 449 | Replies: 2
Thread Tools Search this Thread



Tag cloud for MS SQL
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC