Hi All,
I'm trying to load data from excel to sql server. For this I created an insert statement which is very generic means this statement can be used for any table. I just have to change the name of the sheet and it will automatically pick up the names of the columns and their values from the rows.
Eg: strSQL = "insert into AeroAdm." & ActiveSheet.Name & "(" & CustoString & ") values( " & myString1 & ")"
Now, I'm trying to get a generic update statement.
The problem here is I'm not able to create this statement since this statement has to read one column heading and then the value of the column based on where condition and then the second column heading and the value and so on.
Eg: 'Update AeroAdm.tablename Set col1 = 'val', col 2 = 'val' and so on till the last column where c.Offset(1, 0).value = '';
Can anybody please guide me how this can be achieved?
Thank you
I'm trying to load data from excel to sql server. For this I created an insert statement which is very generic means this statement can be used for any table. I just have to change the name of the sheet and it will automatically pick up the names of the columns and their values from the rows.
Eg: strSQL = "insert into AeroAdm." & ActiveSheet.Name & "(" & CustoString & ") values( " & myString1 & ")"
Now, I'm trying to get a generic update statement.
The problem here is I'm not able to create this statement since this statement has to read one column heading and then the value of the column based on where condition and then the second column heading and the value and so on.
Eg: 'Update AeroAdm.tablename Set col1 = 'val', col 2 = 'val' and so on till the last column where c.Offset(1, 0).value = '';
Can anybody please guide me how this can be achieved?
Thank you