Hi all,
I have a query that I use to export a text file for another database. I am currently testing changes, and need the same output, but formatted into a series of "Insert Into" statements to be able to develop. So I wrote another query to produce a fully formatted text string for each of the four "TempTbl's". The query pulls the correct number of rows, and all the correct information, EXCEPT for each value of the TempTbl. I only return the final temp table in the last nested "else" part of IIF (i.e. "#TempW ").
How can I get the query to insert "#Temp4 ", "#Temp5 ", etc.?
Many thanks!
I have a query that I use to export a text file for another database. I am currently testing changes, and need the same output, but formatted into a series of "Insert Into" statements to be able to develop. So I wrote another query to produce a fully formatted text string for each of the four "TempTbl's". The query pulls the correct number of rows, and all the correct information, EXCEPT for each value of the TempTbl. I only return the final temp table in the last nested "else" part of IIF (i.e. "#TempW ").
How can I get the query to insert "#Temp4 ", "#Temp5 ", etc.?
Many thanks!
Code:
SELECT (IIf([tmpTbl]="[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Temp4]#Temp4[/URL] ","INSERT INTO [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Temp4]#Temp4[/URL] VALUES ('[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Temp4]#Temp4[/URL] ','"&[CHKAccount]&"','"&[RequestID]&"','"&[PlanID]&"','"&[Payroll]&"','"&[SSN]&"','"&[AMT]&"','"&[PayrollAMT]&"','"&[SOURCE]&"','"&[DBID]&"')",IIf([tmpTbl]="[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Temp5]#Temp5[/URL] ","INSERT INTO [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Temp5]#Temp5[/URL] VALUES ('[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Temp5]#Temp5[/URL] ','"&[CHKAccount]&"','"&[RequestID]&"','"&[PlanID]&"','"&[Payroll]&"','"&[SSN]&"','"&[AMT]&"','"&[PayrollAMT]&"','"&[SOURCE]&"','"&[DBID]&"')",IIf([tmpTbl]="[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=TempG]#TempG[/URL] ","INSERT INTO [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=TempG]#TempG[/URL] VALUES ('[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=TempG]#TempG[/URL] ','"&[CHKAccount]&"','"&[RequestID]&"','"&[PlanID]&"','"&[Payroll]&"','"&[SSN]&"','"&[AMT]&"','"&[PayrollAMT]&"','"&[SOURCE]&"','"&[DBID]&"')","INSERT INTO [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=TempW]#TempW[/URL] VALUES ('[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=TempW]#TempW[/URL] ','"&[CHKAccount]&"','"&[RequestID]&"','"&[PlanID]&"','"&[Payroll]&"','"&[SSN]&"','"&[AMT]&"','"&[PayrollAMT]&"','"&[SOURCE]&"','"&[DBID]&"')")))) AS SQLstring
FROM qryFormattedToast2;