« first day  last day (14 days later) » 

7:30 AM
Hi, I am here if you need to ask me anything
 
 
2 hours later…
N K
9:24 AM
helllo
 
Hey N K
 
N K
wats up
 
Nothing much, looking for work abroad :D want to move out of South Africa
 
N K
ohh why ??
any special reason ?
 
Just want to experience new things... I have applied at a couple of companies now so hopefully I hear back from them
 
N K
9:29 AM
Hope u get to hear from them.. Where are ur favourite places to work ?
INDIA :P
?
 
haha havent been to India at all... dont even know what currency they use
I just applied at places like Holland, Finland, Texas etc etc
 
N K
In india we use Indian rupee
The rupee, or more specifically the Indian rupee (symbol: ₹; ISO code: INR) (Unicode U+20B9) is the official currency of the Republic of India. The issuance of the currency is controlled by the Reserve Bank of India. It is named after the silver coin, rupiya, first issued by Sultan Sher Shah Suri in the 16th century and later continued by the Mughal Empire. The modern rupee is theoretically subdivided into 100 paise (singular paisa), though as of 2011 only 50 paise coins are legal tender. Banknotes in circulation come in denominations of ₹5, ₹10, ₹20, ₹50, ₹100, ₹500 and ₹1000. Rupee coins are...
yes
holland, finland are good places to work
you shd try for USA too
 
Oh cool :) yeah, hopefully they would consider hiring someone from South Africa... Just need that one opportunity to get out of here.
 
N K
It seems you are not happy in SA
 
Not really, current government is not running the country well and its affecting our countries financial status abroad. I dont have any dependents so the sooner I can start somewhere abroad the better :)
 
N K
9:35 AM
ohh
It's the issue almost everywhere
now government doesn't work for the welfare of people
they just do it for their sake
what's your real name ?
Mine is: Nadeem khan
 
Yeah... unfortunately.. My name is Pierrie :) So what questions do you have for me today?
 
N K
aah, coming to work
 
Pierrie Kirby :)
 
N K
good name
See this is the procedure what It looks like in present
ALTER PROCEDURE [dbo].[GET_EMP_REPORT]

AS
BEGIN

DECLARE @Count INT
DECLARE @Count_closed INT
DECLARE @Count_pending INT
DECLARE @Count_wip INT
DECLARE @Count_transferred INT
DECLARE @Count_prevpending INT

SELECT *
INTO #temp
FROM (
select distinct a.CUser_id,a.CUser_id User_Id, b.first_name + ' ' + b.last_name NAME,
0 RECEIVED, 0 CLOSED,
0 PENDING, 0 WIP, 0 TRANSFERRED, 0 PREV_PENDING
from inward_doc_tracking_trl a, user_mst b
where a.CUser_id = b.mkey
) AS x

DECLARE Cur_1 CURSOR
FOR SELECT CUser_id, User_Id FROM #temp
Now, I want to add one parameter to the procedure
wherever I am using U_datetime BETWEEN convert(datetime,'16/05/2016',103)
i need to replace this with that date parameter
because date is hardcoded here
got it ?
 
Yep
 
N K
9:40 AM
ok
 
Where is this parameter coming from?
Front-end?
 
N K
yep
 
Is this SP being used in a report?
 
N K
yes
u r right
 
Ok
 
N K
9:42 AM
it will be used to show report
to the client
 
what datatype should the parameter be? date or datetime ?
 
N K
datetime
as my version is 2005
 
ALTER PROCEDURE [dbo].[GET_EMP_REPORT]
@ReportDate DATETIME

AS
BEGIN

DECLARE @Count INT
DECLARE @Count_closed INT
DECLARE @Count_pending INT
DECLARE @Count_wip INT
DECLARE @Count_transferred INT
DECLARE @Count_prevpending INT

SELECT *
INTO #temp
FROM (
select distinct a.CUser_id,a.CUser_id User_Id, b.first_name + ' ' + b.last_name NAME,
0 RECEIVED, 0 CLOSED,
0 PENDING, 0 WIP, 0 TRANSFERRED, 0 PREV_PENDING
from inward_doc_tracking_trl a, user_mst b
where a.CUser_id = b.mkey
) AS x

DECLARE Cur_1 CURSOR
Ok so the SP will now only execute when it has a datetime parameter input from the frontend
 
N K
yes
let me check
 
the frontend should send back the user input value to @ReportDate
 
N K
9:46 AM
yes
that i can handle
while executing
i am getting error as
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '/'.
exec GET_EMP_REPORT 01/04/2016
 
execute following script :

EXEC GET_EMP_REPORT '01/04/2016'
 
N K
oh i missed '
 
yes :)
working?
 
N K
working but with wrong data
:(
 
I've replaced all hardcoded dates with that parameter
Is that correct?
 
N K
9:51 AM
yes
ohh
i guess i took different date
that's why data was not matching
 
So everything filters now according to BETWEEN @ReportsDate AND GETDATE() - which is todays date
Ok haha, try using the same date as yesterday
 
N K
one thing here
while EXEC GET_EMP_REPORT '16/05/2016'
i get error as
Msg 8114, Level 16, State 5, Procedure GET_EMP_REPORT, Line 0
Error converting data type varchar to datetime.
 
That is strange
 
N K
yes
 
and it was executing perfectly with EXEC GET_EMP_REPORT '01/04/2016' ?
 
N K
9:54 AM
yes
 
Try executing EXEC GET_EMP_REPORT '01/04/2016' again please
 
N K
yes executed
look both the screenshot
its not working '16/05/2016'
 
Try :

EXEC GET_EMP_REPORT '05/16/2016'
 
N K
it worked
mm/dd/yyyy
?
 
Yes...
 
N K
9:57 AM
but i want in dd/mm/yyyy
see how i use to do it with hard code values
AND U_datetime BETWEEN convert(datetime,'16/05/2016',103) AND GETDATE()
 
Yes... try changing the parameter to DATE and then just insert the
converts
 
N K
will DATE work for 2005 ?
see i m getting error as
Column, parameter, or variable #1: Cannot find data type DATE.
 
ALTER PROCEDURE [dbo].[GET_EMP_REPORT]
@ReportDate DATE

AS
BEGIN

DECLARE @Count INT
DECLARE @Count_closed INT
DECLARE @Count_pending INT
DECLARE @Count_wip INT
DECLARE @Count_transferred INT
DECLARE @Count_prevpending INT

SELECT *
INTO #temp
FROM (
select distinct a.CUser_id,a.CUser_id User_Id, b.first_name + ' ' + b.last_name NAME,
0 RECEIVED, 0 CLOSED,
0 PENDING, 0 WIP, 0 TRANSFERRED, 0 PREV_PENDING
from inward_doc_tracking_trl a, user_mst b
where a.CUser_id = b.mkey
) AS x

DECLARE Cur_1 CURSOR
Date format not working in 2005??
 
N K
no
2005 doesn't support date
it works for datetime
 
Not sure if there is a work around to this
Just doing a bit of research. Will let you know if I find anything
 
N K
10:04 AM
sure
i m also searching
 
N K
10:20 AM
I tried like this
Convert(datetime,@ReportDate, 103)
it still not workin
 
So the only problem is executing the SP with the correct date format... It is currently accepting MM/DD/YYY but you want it as DD/MM/YYYY
 
N K
yup
did u got something ?
 
Nothing as of yet :( might be a good idea to ask this on stackoverflow and see what the other guys can come up with
think that would be the best time wise
 
N K
YUP
will post now
again
 
10:37 AM
Ok
 
N K
ill add the link here too
 
Yes please
 
N K
10:54 AM
have a look
0
Q: Adding datetime as a parameter is giving Error converting data type varchar to datetime (Error) in stored procedure

N KI have a stored procedure which accepts one parameter as @ReportDate. but when I execute it with parameter it gives me error as Error converting data type varchar to datetime. Here is the SP. ALTER PROCEDURE [dbo].[GET_EMP_REPORT] @ReportDate Datetime AS BEGIN DECLARE @Count INT DECLAR...

if something is wrong please edit
 
N K
11:06 AM
no 1 yet commented
 
Yeah... think just give it a couple of minutes... I am sure someone would give you a good answer
 
N K
ok
waiting
 
Only 5 views
 
N K
yes
6
 
Think you should add SQL in your tags
It wont allow me because I need to updated the question with 10 characters then
 
N K
11:18 AM
ok
added
one answer
but not as expected
 
Yeah I see... that doesnt really help though. The SP isnt the problem here, we want to be able to execute the SP with the format provided in the question
 
N K
yes
 

« first day  last day (14 days later) »