Click here to Skip to main content
15,888,977 members
Home / Discussions / Database
   

Database

 
AnswerRe: SQLite: Correlated "EXISTS" vs uncorrelated "IN" Pin
CHill6013-Mar-16 10:12
mveCHill6013-Mar-16 10:12 
AnswerRe: SQLite: Correlated "EXISTS" vs uncorrelated "IN" Pin
Jörgen Andersson13-Mar-16 11:00
professionalJörgen Andersson13-Mar-16 11:00 
AnswerRe: SQLite: Correlated "EXISTS" vs uncorrelated "IN" Pin
Midi_Mick14-Mar-16 2:25
professionalMidi_Mick14-Mar-16 2:25 
QuestionUnable to write data on to the Excel Pin
indian1438-Mar-16 7:40
indian1438-Mar-16 7:40 
AnswerRe: Unable to write data on to the Excel Pin
indian1438-Mar-16 12:34
indian1438-Mar-16 12:34 
GeneralRe: Unable to write data on to the Excel Pin
Mycroft Holmes8-Mar-16 13:17
professionalMycroft Holmes8-Mar-16 13:17 
GeneralRe: Unable to write data on to the Excel Pin
indian1439-Mar-16 4:19
indian1439-Mar-16 4:19 
GeneralRe: Unable to write data on to the Excel - Resolved Pin
indian1439-Mar-16 7:19
indian1439-Mar-16 7:19 
Thanks buddy, finally at last I could able to do it man !... hah.

Here is my code to do it may be can be helpful to somebody else, first I wrote a query to just print Headers and then query to print content then I appended those two files with cmd shell into one final file
DECLARE @cmd VARCHAR(8000)='',
@sqlContentQuery varchar(max) = '"Select top 5 * From WEB_WebAdmin.dbo.Provider"',
@sqlTemplQuery varchar(max) = '"Select ''WA ProviderId'' WebAdmProviderId, ''WA Last Name'' LastName, ''WA First Name'' FirstName, ''WA Date of Birth'' Dob, '
+ '''PS ProviderId'' WebAdmProviderId, ''PS Last Name'' LastName, ''PS First Name'' FirstName, ''PS Date of Birth'' Dob"',
@ContentFilePath varchar(max)='"\dcqwdbs057\Users\AleemA\Desktop\Dont Remove ThisFolder\ProviderSearchDataMigration\Content.xls"',
@TemplFilePath varchar(max)='"\dcqwdbs057\Users\AleemA\Desktop\Dont Remove ThisFolder\ProviderSearchDataMigration\TemplateFile.xls"',
@FinalFilePath varchar(max)='"\dcqwdbs057\Users\AleemA\Desktop\Dont Remove ThisFolder\ProviderSearchDataMigration\Final.xls"'

SET @cmd = 'bcp '+ @sqlTemplQuery + '  queryout ' + @TemplFilePath + ' -c -C -T'
Exec xp_cmdshell @cmd

SET @cmd = 'bcp '+ @sqlContentQuery + '  queryout ' + @ContentFilePath + ' -c -C -T'
Exec xp_cmdshell @cmd

SET @cmd = 'copy  ' + @TemplFilePath +' + '+ @ContentFilePath +' ' + @FinalFilePath + ''
exec master..xp_cmdshell @cmd
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."


modified 9-Mar-16 19:55pm.

GeneralRe: Unable to write data on to the Excel - limitation Pin
indian1439-Mar-16 10:38
indian1439-Mar-16 10:38 
QuestionMigrate columns which have carriage return and line feed Pin
indian1437-Mar-16 12:02
indian1437-Mar-16 12:02 
AnswerRe: Migrate columns which have carriage return and line feed Pin
Richard MacCutchan7-Mar-16 22:04
mveRichard MacCutchan7-Mar-16 22:04 
QuestionRe: Migrate columns which have carriage return and line feed Pin
CHill608-Mar-16 2:26
mveCHill608-Mar-16 2:26 
AnswerRe: Migrate columns which have carriage return and line feed Pin
indian1438-Mar-16 7:36
indian1438-Mar-16 7:36 
QuestionHow to store procedure or function to use in asp.net Pin
hmanhha4-Mar-16 15:52
hmanhha4-Mar-16 15:52 
AnswerRe: How to store procedure or function to use in asp.net Pin
Richard MacCutchan4-Mar-16 22:22
mveRichard MacCutchan4-Mar-16 22:22 
QuestionHow to get exactly date from Oracle Link DB in SQL server. Pin
hmanhha3-Mar-16 16:07
hmanhha3-Mar-16 16:07 
AnswerRe: How to get exactly date from Oracle Link DB in SQL server. Pin
Mycroft Holmes3-Mar-16 19:18
professionalMycroft Holmes3-Mar-16 19:18 
GeneralRe: How to get exactly date from Oracle Link DB in SQL server. Pin
hmanhha3-Mar-16 22:53
hmanhha3-Mar-16 22:53 
GeneralRe: How to get exactly date from Oracle Link DB in SQL server. Pin
Richard MacCutchan3-Mar-16 23:22
mveRichard MacCutchan3-Mar-16 23:22 
GeneralRe: How to get exactly date from Oracle Link DB in SQL server. Pin
Mycroft Holmes4-Mar-16 12:52
professionalMycroft Holmes4-Mar-16 12:52 
GeneralRe: How to get exactly date from Oracle Link DB in SQL server. Pin
hmanhha6-Mar-16 16:52
hmanhha6-Mar-16 16:52 
GeneralRe: How to get exactly date from Oracle Link DB in SQL server. Pin
Mycroft Holmes6-Mar-16 19:56
professionalMycroft Holmes6-Mar-16 19:56 
GeneralRe: How to get exactly date from Oracle Link DB in SQL server. Pin
hmanhha6-Mar-16 22:09
hmanhha6-Mar-16 22:09 
GeneralRe: How to get exactly date from Oracle Link DB in SQL server. Pin
Jörgen Andersson7-Mar-16 6:35
professionalJörgen Andersson7-Mar-16 6:35 
QuestionConvert Text to datetime Pin
Jassim Rahma2-Mar-16 10:29
Jassim Rahma2-Mar-16 10:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.