April 29, 2012 at 6:46 am
HI all,
pls can you answer me it's urgent task..i searched in online but no luck yet...
April 29, 2012 at 7:49 am
EXECUTE master.dbo.xp_cmdshell 'bcp "SELECT object_name(object_id) As TbLName,name as ColName FROM SandBox.sys.columns ORDER BY object_name(object_id), column_id" queryout C:\Data\Objects.txt -t"|" -c -T '
Lowell
April 29, 2012 at 8:30 am
Hi Lowel,
Thanks for ur quick response ..can i do that in master database because i'm a tester i don't know ..can i do that or not..
Here is my database details..can you answer accordingly..
My db name:Max_Test
My table name: #temp.
I need these columns from that table are offer_id,reservation_num,personal_id,acct_nbr_he.
PLs reply TIA.
April 29, 2012 at 12:28 pm
tswathi21 (4/29/2012)
Hi Lowel,Thanks for ur quick response ..can i do that in master database because i'm a tester i don't know ..can i do that or not..
Here is my database details..can you answer accordingly..
My db name:Max_Test
My table name: #temp.
I need these columns from that table are offer_id,reservation_num,personal_id,acct_nbr_he.
PLs reply TIA.
You want that with or without column headers?
--Jeff Moden
Change is inevitable... Change for the better is not.
April 29, 2012 at 12:37 pm
Never mind. We'll do it both ways.
Since you're a tester and don't know much about SQL Server or SSMS, we'll do this as simply as possible.
Paste the following code into SSMS on same window that create the #Temp table, highlight the code, and then press the f5 key. Copy the output from the results and paste into notepad. Save the notepad file.
--===== Comment out from here through UNION ALL
-- if you don't want column headers.
SELECT 'Offer_ID' + '|'
+ 'Reserveration_Num' + '|'
+ 'Personal_ID' + '|'
+ 'Acct_Nbr_HE' + '|'
UNION ALL
SELECT CAST(Offer_ID) AS VARCHAR(8000)) + '|'
+ CAST(Reserveration_Num) AS VARCHAR(8000)) + '|'
+ CAST(Personal_ID) AS VARCHAR(8000)) + '|'
+ CAST(Acct_Nbr_HE) AS VARCHAR(8000)) + '|'
FROM temp
;
--Jeff Moden
Change is inevitable... Change for the better is not.
April 29, 2012 at 3:48 pm
Hello Jeff,
Thanks for ur time and quick response..
Actually I did in otherway ..
In SSMS- tools-options--there i select results to text ..and changed the custom delimited to | ..and i ran that it worked for me..Saved the results to a file....
Thank you so much again...
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply