Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 help

Author  Topic 

lpapp
Starting Member

8 Posts

Posted - 2006-11-30 : 03:45:50
ok the criteria with hath i have the problem looks like this


SELECT DISTINCT Contractdetailat.NRCONTRACT, Contractdetailat.DINDATA,
Contractdetailat.PINALADATA, Contractdetailat.PUNCTDELUC,
Contractdetailat.COMPONENTE, Contractdetailat.PRETUNITAR,
Contractdetailat.NRBUC, Contractdetailat.PRETTOTAL,
Firma.DENUMIREFI, Firma.NRREGCOM, Firma.CODFISCAL,
Firma.SEDIULSOCI, Firma.JUDETUL, Firma.CODIBAN,
Firma.BANCA, Firma.PUNCTDELUC, Firma.NRCONTRACT,
Delegati.NUMELEDELE, Delegati.BI_CI_, Delegati.SERIA,
Delegati.ELIBERATPO, Delegati.MIJLOCTRAN,
Delegati.NRMASINA, Delegati.DATAEXPED
FROM "D:\ISTI\28.11.2006\contractdetailat.dbf" Contractdetailat
INNER JOIN "D:\ISTI\28.11.2006\firma.dbf" Firma
ON (Contractdetailat.NRCONTRACT = Firma.NRCONTRACT) , "D:\ISTI\28.11.2006\delegati.dbf" Delegati
WHERE (Contractdetailat.NRCONTRACT = Firma.NRCONTRACT)
AND (Contractdetailat.NRCONTRACT LIKE '............')



in this section ........ i have to introduce the next statment editbox text or other component datavalue wich is al integer value asstring

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-30 : 03:55:15
Without sample data, your expected output/result based on the provided sample data, it is hard to tell.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

swatib
Posting Yak Master

173 Posts

Posted - 2006-11-30 : 03:58:02
Do you need to execute a query having dynamic ORDER BY value?

If yes, the try this:

declare @colname varchar(50)
set @colname='cityname'
EXEC ('select * from citymaster order by ' + @colname)

Njoy Life
Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2006-11-30 : 04:22:47
If all you want to do is parametere substition, then write a stored procedure that executes your statement and then, in the LIKE statement, compare to your variable -


CREATE PROCEDURE moo
@yourvariable VARCHAR(30)
AS
BEGIN
SELECT column FROM yourtable WHERE somecolumn LIKE @yourvariable
END


If you want to convert stuff from INTs, then probably it is easiest to do this in your web application, when you validate the input. You shouldn't directly be passing the contents of a text box into your query without pre-processing and validation anyway.

-------
Moo. :)
Go to Top of Page

lpapp
Starting Member

8 Posts

Posted - 2006-11-30 : 04:56:59
thanks but i have anopdher problem in the sql statment it gives me the message token "@variale " maybe i didnt defined rigth i'l try te sql documentation to help me .
or i'l try to defining it in the source code too but maybee i'll get a double definirion error i'm working on it i'll be back with te final answer.



quote:
Originally posted by mr_mist

If all you want to do is parametere substition, then write a stored procedure that executes your statement and then, in the LIKE statement, compare to your variable -


CREATE PROCEDURE moo
@yourvariable VARCHAR(30)
AS
BEGIN
SELECT column FROM yourtable WHERE somecolumn LIKE @yourvariable
END


If you want to convert stuff from INTs, then probably it is easiest to do this in your web application, when you validate the input. You shouldn't directly be passing the contents of a text box into your query without pre-processing and validation anyway.

-------
Moo. :)



papp
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-30 : 05:22:12
This seems to be a MS ACCESS query!
Please post in proper forum here http://www.sqlteam.com/forums/forum.asp?FORUM_ID=3


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-30 : 05:45:40
Discussion continues here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=75620

Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -