Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 548853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:07:24+00:00 2026-05-13T11:07:24+00:00

I have the following piece of SQL that does not work: declare @id INT;

  • 0

I have the following piece of SQL that does not work:

declare @id INT; 
set @id=0; 
exec insert_mail @id OUTPUT, 'ZLgeOZlqRGC6l57TyD/xYQ==', 4928, '2010\01\14\14\03131_2.eml', 'Suz, Katie and Kourtney''s Housewarming Party', CONVERT(DATETIME, '2015-01-18 14:03:13', 120); 
select @id;

and changing it this way fixes it:

declare @id INT; 
set @id=0; 
declare @p_valid_until datetime;
set @p_valid_until=CONVERT(DATETIME, '2015-01-18  14:03:13', 120)
exec insert_mail @id OUTPUT, 'ZLgeOZlqRGC6l57TyD/xYQ==', 4928, '2010\01\14\14\03131_2.eml', 'Suz,  Katie and Kourtney''s Housewarming Party', @p_valid_until; 
select @id;

Anybody can explain?

Cheers,
Jan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:07:25+00:00Added an answer on May 13, 2026 at 11:07 am

    In the first case you are calling the CONVERT function in an execute command which is not allowed. You can’t call functions in the passing of arguments

    EXECUTE insert_mail ... CONVERT(DATETIME, '2015-01-18 14:03:13', 120)
    

    I don’t see the point of using the convert function. Just type date in without convert.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following piece of SQL code that does the following: Obviously looks
I have the following piece of inline SQL that I run from a C#
I have the following piece of SQL that will check if any duplicate records
I have the following piece of code in C++. int arr[] = {1, 2,
I have a piece of code that creates an SQL Server Express 2008 in
Let's says I have a set of tables that match the following scenario: Crates
I have the following line of SQL that returns all fanart in the db
I have following piece of code: class Test{ private: int id; public: Test(int v):id(v)
I have written the following piece of code ( sql clr stored procedure )
I have the following piece of SQL: select DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)) which comes through as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.