Have you tried running the script with out the comments? I'm not sure how you execute the query but if for some reason it is sent without carriage returns, it is executed as a long one line query. The comments would therefore comment out a lot of the code.
Wrong forum, but to answer your question you can indeed use ExecuteNonQuery to return values from the store procedure but you need to set the direction of your return parameters to returnParameter.Direction = ParameterDirection.ReturnValue.
Alternatively you can use ExecuteReader which is used...
I think I understand you now. Does this work for you?
create function [dbo].[fn_MTD_V1]
(
@report_date datetime
)
returns int
as
begin
declare @days int
declare @endmonth datetime
set @endmonth = dateadd(d,-1,dateadd(mm,datediff(m,0,@report_Date)+1,0))
set @days = day(@endmonth)
if...
Hi,
How about the following?
create function fn_MTD_V1
(
@report_date datetime,
@calendar_id smallint
)
returns int
as
begin
declare @days int
if (dbo.ABfn_IsNonWorkingDay(dateadd(d,-1,dateadd(mm, datediff(m,0,@report_date)+1,0)),@calendar_id) = 0)
begin
set @days = datediff(day...
How about...
declare @temp table (id int, col varchar(50))
insert into @temp values (1, 'abc-1-a-2-01')
insert into @temp values (2, 'efg-2-b-3-02')
;with cte as
(
select t2.id, t3.split, ROW_NUMBER() over (partition by t2.id order by t2.id) as num
from (
select *...
Hi,
Will this work for you?
;with a as
(
SELECT row_number() over (partition by tktnum order by tktnum) as idx, *
FROM #XY123
),
b as
(
select *, case when exists (select idx from a as a2 where a.tktnum = a2.tktnum and a.arrivalcty = a2.departcty and a2.idx < a.idx) then 1 else 0 end as...
This query is only giving me the 09/30/2013, I need the 09/30/2013 and 09/30/2014 paid thru."
Your query looks correct. Why are you expecting 09/30/2014 when by your definition, it should only return 09/30/2013 when the current month is 11?
Hi,
I have a database design question that I was hoping a DB professional could answer. Lets say I have the following one-to-many table relationship between an Account and its Addresses.
create table account (
acctkey int,
acctname varchar(100),
active bit
)
create table acctaddress...
Hi,
I have a basic understanding of how fluent api's are used EF and how they define properties and relationships of the tables.
My question is how do I go about defining a collection of entities that are soft linked.
eg. Say I have a Contact table and a generic [MapTable].
[MapTable]
MapID...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.