473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Set SP parameter

Hi all,

My SP looks like:

CREATE PROCEDURE dbo.SPRazduznicaZM
(@Datum datetime,
@Nalog smallint)
AS SELECT FCNabavneCijeneZM.RobnoObjekat,
dbo.TBLNaloziProizvodnjeOs.NProId,
dbo.TBLNaloziProizvodnjeOs.NProZalihe AS Zalihe,
dbo.TBLNaloziProizvodnjeOs.NProPT AS
ProizvodnjaUToku, dbo.TBLNaloziProizvodnjeOs.NProGP AS GotoviProizvodi,

dbo.TBLArtikliNormativi.ArtNormSirovina AS
Sirovina,

SUM(ROUND(dbo.TBLNaloziProizvodnjeSt.NProStKolicin a *
dbo.TBLArtikliNormativi.ArtNormKolicina, 4)) AS PotrebnaKolicina,
SUM(FCNabavneCijeneZM.TrenutnoStanje) AS
StanjeSkladista, FCNabavneCijeneZM.ProsjecnaNabavna,
FCNabavneCijeneZM.ProsjecnaProdajna,
dbo.TBLNaloziProizvodnjeOs.NProDatum
FROM dbo.FCNabavneCijeneZM(@Datum) FCNabavneCijeneZM LEFT OUTER
JOIN
dbo.TBLArtikliNormativi ON
FCNabavneCijeneZM.RobnoArtikal =
dbo.TBLArtikliNormativi.ArtNormSirovina RIGHT OUTER JOIN
dbo.TBLNaloziProizvodnjeSt ON
dbo.TBLArtikliNormativi.ArtNormArtikal =
dbo.TBLNaloziProizvodnjeSt.NProStArtikal RIGHT OUTER JOIN
dbo.TBLNaloziProizvodnjeOs ON
dbo.TBLNaloziProizvodnjeSt.NProId = dbo.TBLNaloziProizvodnjeOs.NProId
GROUP BY FCNabavneCijeneZM.RobnoObjekat,
dbo.TBLNaloziProizvodnjeOs.NProId,
dbo.TBLNaloziProizvodnjeOs.NProZalihe,
dbo.TBLNaloziProizvodnjeOs.NProPT,
dbo.TBLNaloziProizvodnjeOs.NProGP,
dbo.TBLArtikliNormativi.ArtNormSirovina,
FCNabavneCijeneZM.ProsjecnaNabavna,
FCNabavneCijeneZM.ProsjecnaProdajna,
dbo.TBLNaloziProizvodnjeOs.NProDatum
HAVING (FCNabavneCijeneZM.RobnoObjekat =
dbo.TBLNaloziProizvodnjeOs.NProZalihe) AND
(dbo.TBLNaloziProizvodnjeOs.NProId = @Nalog)

I would like to set parameter
@Datum=dbo.TBLNaloziProizvodnjeOs.NProDatum

What's right way to do this?

Regards,

Feb 1 '06 #1
1 1162
le*****@yahoo.com (le*****@yahoo.com) writes:
CREATE PROCEDURE dbo.SPRazduznicaZM
(@Datum datetime,
@Nalog smallint)
AS SELECT FCNabavneCijeneZM.RobnoObjekat,
...
FROM dbo.FCNabavneCijeneZM(@Datum) FCNabavneCijeneZM LEFT OUTER
...

I would like to set parameter
@Datum=dbo.TBLNaloziProizvodnjeOs.NProDatum

What's right way to do this?


It's not clear to me what you mean. My guess is that in the call
to the user-defined table function, you want to pass a column as the
parameter, rather than a variable.

On SQL 2000, this is not possble.

On SQL 2005, you can use the new CROSS APPLY operator.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dan | last post by:
I've run into an interesting problem, and seemed to have stumped 3 newsgroups and 2 other forums. For some reason when I try to insert a record into a SQL table that has a Text column, the...
3
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can...
2
by: John A Grandy | last post by:
Is there something special in XML about the name "Parameter" ... I am not able to XPATH query for nodes named "Parameter" <Root> <Category CategoryID="1"> <Elements> <Element...
2
by: PK | last post by:
Hi, I have an application that opens a Crystal report document and passes in a value to a parameter in the report (pointing to an Oracle DB). However, if I want to pass a "null" value to retrieve...
7
by: Richard Grant | last post by:
Hi. In c/C++ i can pass the address of a subroutine to another subroutine as an actual parameter How do I do that in VB .NET What should be the syntax for a parameter to receive the address of a...
4
by: Ranginald | last post by:
Hi, I'm having trouble passing a parameter from my default.aspx page to my default2.aspx page. I have values from a query in a list box and the goal is to pass the "catID" from default.aspx...
16
by: hzmonte | last post by:
Correct me if I am wrong, declaring formal parameters of functions as const, if they should not be/is not changed, has 2 benefits; 1. It tells the program that calls this function that the...
3
by: Ken Cox [Microsoft MVP] | last post by:
I've been going around and around on this one. I can't believe that it is "by design" as Microsoft says. Here's the situation: In *declarative* syntax, I'm trying to create a default datetime...
20
by: exipnakias | last post by:
Hello Guys. In a form I created a listbox which looks up the values of a table. I want: 1) ..to create a query where a parameter will be needed in order to be loaded. But I do not want to...
5
by: Trevisc | last post by:
Happy Thursday Everyone, I am trying to create a parameter that is one long varchar but that will be used in a SQL statement IN function: //string queryString = GetCurrentTitles(); //Below is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.