sql server - How to insert date from a coldfusion variable to a sql field? -
because of unusual setup of code, instead of using cfquery cfparam tags, instead building sqlinsertcols list , sqlinsertvalues list , using in insert statement. code this:
<cfscript> var sqlinsertcols = ""; var sqlinsertvalues = ""; // looping , other processing here fill lists ... </cfscript> <cfquery datasource="..." name="insert"> insert mytable(#sqlinsertacols#) values (#sqlinsertvals#) </cfquery>
firstly, there security issues this, considering both sql strings populated within code , not based on user input?
and has worked several fields inserting, tried add together date field , can't insert work. date in format "mm/dd/yyyy". code add together date sql lists:
sqlinsertcols = listappend(sqlinsertcols, "mydatefield"); sqlinsertvalues = listappend(sqlinsertvalues, mydatevar);
this runs no errors value in db 1900-01-01 00:00:00.000
.
i've tried adding quotes around date can't seem insert properly. there way accomplish this?
sql sever uses single quotes around dates. have tried those?
sql sql-server datetime coldfusion
No comments:
Post a Comment