wsilage
Yak Posting Veteran
82 Posts |
Posted - 2014-08-26 : 14:41:07
|
I have a SQL table that I need to export into a file. The requirements need to be this...File should be pipe ("|") delimited .txt file with date in filename (CCYYMMDD)How can I do that?My Query that I have is like this that goes into my table Unless, this portion doesn't matter, but I wanted to share with you.SELECT Distinct LEFT([First Name],100) [First Name],LEFT([Last Name],50) AS [Last Name],LEFT([Product],40) AS [Network],LEFT([Degree],10) AS [Title],LEFT([Tax ID],9) AS [TAX ID],LEFT([Address 1],75) AS [Address 1],LEFT([Address 2],75) AS [Address 2],LEFT([City],25) as [City],LEFT([St],2) AS [ST],LEFT([Zip],10) AS [ZIP],LEFT([COUNTY],100) AS [County],LEFT([Phone],12) AS [Phone],CONVERT(varchar(10), [Effective Date], 112) AS [Provider Effective Date], ---CCYYMMDDCONVERT(VARCHAR(10), [Termination Date], 112) AS [Provider Termination Date], ---CCYYMMDDCase When [Address 1] = [Billing Address] or [pro_btag] = 'Y' Then 'P'Else ''End as [Location Type],LEFT([Spec 1],50) AS [Primary_Specialty],LEFT([NPI],40) as [Physician_NPI],LEFT([PCS Number],40) as [Provider_Key],LEFT([PRO ID],40) as [Sequence_Key]From vw_test |
|
wsilage
Yak Posting Veteran
82 Posts |
Posted - 2014-08-26 : 15:14:32
|
bcp MonthEnds.dbo.HMHP out c:\temp\YourTbl_20140826.txt -T -bisql\instance1 -c -t"|" -r\r\nI added my info, but I am getting an error saying belowMsg 102, Level 15, State 1, Line 4Incorrect syntax near '.'.quote: Originally posted by tkizer bcp YourDb.dbo.YourTbl out c:\temp\YourTbl_20140826.txt -T -Sserver1\instance1 -c -t"|" -r\r\nTara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/
|
|
|