select top 0 * into #tmpdatabase from ABTABLE;
select * from #tmpdatabase;
BULK INSERT #tmpdatabase FROM $fileupload WITH (FIELDTERMINATOR =';',ROWTERMINATOR ='\n' ,FIRSTROW = 2);
MERGE ABTABLE AS T
USING #tmpdatabase AS S
ON (T.A = S.A)
WHEN NOT MATCHED BY TARGET
THEN INSERT(
[A]
,[K]
)
VALUES(
S.[A]
,S.[K]
)
WHEN MATCHED
THEN UPDATE
SET T.[A] = S.[A]
,T.[K] = S.[K];
drop table #tmpdatabase;
Hi, I'm trying to convert this query that I make from Toad that loads a file into a tempdatabase from .csv file based on an existing table on the sql server into autoit friendly code but don't know how to do it, been rubbing my head on this one :P, maybe need a different approach?
I'm using AutoIt Version: 3.3.10.2
This doesn't seem to do anything:
Local $obj_SQL_DB = _SQLConnect("db.u\SQl1", "data", 1, "At", "Pass")
If @error Then Return SetError(50, @error, -1)
Local $strSQL = "select top 0 * into #tmpdatabase from ABTABLE;"
$obj_SQL_DB.Execute($strSQL)
Any suggestions would be fantastic
Nevermind i managed to do this like this instead :), mark as solved!
Local $file = FileOpen("\TEST\SQL_UPD.txt",0)
Local $strSQL = FileRead($file)
$obj_SQL_DB.Execute($strSQL)