Use of temporary functions or procedure within a script
<p>I am using <strong>SQL Server 2012</strong>, i have a script by which i am inserting values to a table, in that script i have to convert the format of some <code>DateTime</code> variables on the basis of two parameters.</p>

<p>I can do it using <code>CASE</code> or <code>if</code> condition in <code>sql</code>. I am not allowed to make any <code>Function</code> or <code>procedure</code> in the database to which i can refer.</p>

<p>Is there any other way like creating a <code>temporary function</code> or <code>temporary procedure</code> within the <strong>script</strong> to apply condition alter the format for <code>Datetime</code> values?</p>