Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
1-1) query this new cf dsn using <cfquery> tag:
<cfquery name="myxlsdata" datasource="...">
SELECT * FROM .....
</cfquery>
1-2) <cfset> a var for your id value:
<cfset curID = 2147>
1-3) <cfoutput> the myxlsdata query and insert data into your sql server table, incrementing curID value with every loop iteration:
<cfoutput query="myxlsdata">
<cfquery name="insertdata" datasource="your-sql-serve
INSERT INTO ...
(id, col1, col2, ..., colN)
VALUES
(#curID#, #myxlsdata.integer_col1#, '#myxlsdata.text_col2#', ..., #myxlsdata.colN#)
</cfquery>
<cfset curID = curID + 1>
</cfoutput>
2) if cf5 does not allow the above, export your xls file as csv (comma-separated values) file
2-1) read the file into a variable using <cffile>:
<cffile action="read" file="full\path\to\csv\fil
2-2) <cfset> a var for your id value:
<cfset curID = 2147>
2-3) <cfloop> over the above variable, treating it as a CR+LF-delimited list, and insert data into your sql server table in each loop iteration and incrementing curID variable:
<cfloop list="#mycsvfile#" delimiters="#chr(13)&chr(1
<!--- now ROW variable (loop index) represents each line in your csv file, which in turn is a comma-delimited list of values to be inserted. use listGetAT() function to get individual row elements --->
<cfquery name="insertdata" datasource="your-sql-serve
INSERT INTO ...
(id, col1, col2, ..., colN)
VALUES
(#curID#, #listGetAt(row, 1)#, '#istGetAt(row, 2)#', ..., #istGetAt(row, N)#)
</cfquery>
<cfset curID = curID + 1>
</cfloop>
that's the gist of it...
make sure the ID column in your sql server table allows you to insert data into it!
there are, however, numerous possible pitfalls to watch out for, especially with CSV approach, the biggest one being empty cell in xls file:
since csv file's lines (rows of data from your xls sheet) are treated as a comma-delimited list, and CF treats consecutive list delimiters as one list element, you MUST make sure each and every cell in your xls file has a value - empty cells should probably be filled with NULLs/0/spaces whatever is appropriate
another pitfall is: you must make sure that TEXT values you are inserting are enclosed in ' (single quotes) and NUMERIC values are not. you basically have to have a very detailed knowledge of the data in your xls file and how it corresponds to the columns in your sql server table.
hope this helps!
Azadi