Custom Date/Time formatting in SQL Server

Use DATENAME and wrap the logic in a Function, not a Stored Proc declare @myTime as DateTime set @myTime = GETDATE() select @myTime select DATENAME(day, @myTime) + SUBSTRING(UPPER(DATENAME(month, @myTime)), 0,4) Returns “14OCT” Try not to use any Character / String based operations if possible when working with dates. They are numerical (a float) and performance … Read more

Stored procedure that exports data into csv files only exports to one file

Seems to work fine for me. I have a few suggestions: (1) stop doing all that string concatenation to build a date. You can do the same thing much easier as in: SELECT @StartDT = DATEADD(MONTH, DATEDIFF(MONTH, ‘19000101’, @MinDOS), ‘19000101’); (2) stop declaring varchar without length. And to ensure the right output, I prefer convert: … Read more

Array in IN() clause oracle PLSQL

Assuming that your collection is defined in SQL, not just in PL/SQL, you can use the TABLE operator (the definition you posted isn’t syntactically valid– you’d need to specify a length for the VARCHAR2) AND p.plc_status IN (SELECT column_value FROM TABLE( plcListchar )) Since I don’t have your tables, an example using the SCOTT schema … Read more

Calling stored procedure using VBA

Victoria, You can run a stored procedure using ADO, like below… Set mobjConn = New ADODB.Connection mobjConn.Open “your connection string” Set mobjCmd = New ADODB.Command With mobjCmd .ActiveConnection = mobjConn .CommandText = “your stored procedure” .CommandType = adCmdStoredProc .CommandTimeout = 0 .Parameters.Append .CreateParameter(“your parameter name”, adInteger, adParamInput, , your parameter value) ‘ repeat as many … Read more