Today I wrote a stored procedure that executes with the current time as a parameter to the stored procedure, causing a number of problems.
See the original notation
Error. SQL error
Startsyntax near ‘)’ because the function cannot be used as a parameter to the stored procedure. Modified to
In SQL, you assign the return value of the getDate () function to a variable, and then assign it to the stored procedure variable. This error is resolved.
USE [TransferLog]
GO
DECLARE @return_value int,
EXEC @return_value = [dbo].[SSISLog_InsertQCTransferLog]
@StartDate = getdate(),
@LogCategoryId = 2,
@AffectRows = '',
@QCLastModifiedDate = N'''',
@ErrorMessage = N'',
@MaxAuditLogId = '',
@MaxAuditPropertyId = ''
SELECT 'Return Value' = @return_value
SELECT CONVERT(datetime, GETDATE(), 120) AS Date
GO
USE [TransferLog]
GO
DECLARE @return_value int,
@timee datetime=getdate()
EXEC @return_value = [dbo].[SSISLog_InsertQCTransferLog]
@StartDate = @timee,
@LogCategoryId = 2,
@AffectRows = '',
@QCLastModifiedDate = N'',
@ErrorMessage = N'''',
@MaxAuditLogId = '',
@MaxAuditPropertyId = ''
SELECT 'Return Value' = @return_value
select @timee
SELECT CONVERT(datetime, GETDATE(), 120) AS Date
GO
But there it is again
The Error converting Data type, nvarchar to datetime, always thought that the Error converting type is still the wrong thing to assign to @startDate. I get a lot of replies on the Internet that say CONVERT(datetime, GETDATE(), 120) conversion type
The type of @qclastModifiedDate is also datetime, but in
Error.sql, I gave it a value
@QCLastModifiedDate=N””
After changing @qclastModifiedDate =N “, the error is gone. The database QCLastModifiedDate was written to the default value ‘1900-01-01 00:00:00 00.000’.
Right at last. True. SQL is the correct script after modification. I really need to be careful
Read More:
- Arithmetical overflow error converting expression to data type datetime
- Solution of error converting data type varchar to datetime in SQL Server
- Converting string object into datetime type in pandas
- Arithmetic overflow error converting identity to data type int
- Arithmetic overflow error converting numeric to data type numeric.
- No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.la
- Mybatis integrates Oracle query and reports an error in the datetime type field
- Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column xxxx
- About content type ‘multipart / form data…’ not support
- ‘Conversion failed when converting date and/or time from character string.DB-Lib error message 241,
- Pit encountered by entity class data type BigDecimal
- Error in data training: valueerror: unknown label type: ‘continuous‘
- Failed to convert value of type ‘java.lang.String‘ to required type ‘java.util.Date‘;
- Converting PDF file to JPG image in Ubuntu
- error: non-const lvalue reference to type cannot bind to a value of unrelated type
- Error converting jupyter notebook to PDF
- Schema validation failed with the following errors: data path “. Budgets [1]. Type” should be
- Error in machine learning training data (FIT): valuee rror:Unknown label type:‘continuous‘
- Inconsistency between adapter data and UI data after dragging recyclerview (data disorder)
- Winsw throws an exception “error 1067: unexpected process termination” when converting Java application to Windows Service