|
what is about 7th highest. can you tell me plz
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Select *,sal From Emp X Where n =<br />
(<br />
Select Count(Distinct Sal) From Emp Where sal >=X.sal<br />
)
Where n = 7
|
|
|
|
|
Thanks It is the correct answer . Thanks Again.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Hello Friends,
May be I am missing some thing here while trying to build a dynamic WHERE clause.
this is the final version of my Stored pror
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[USP_SearchVehicleOnYMM]
@Year char(4)
,@Make int
,@Model int
AS
BEGIN
SET NOCOUNT ON;
IF LEN(@Year)<=0
begin
select @Year = NULL
end
IF LEN(@Make)<=0
begin
select @Make = NULL
end
IF LEN(@Model)<=0
begin
select @Model = NULL
end
SELECT V.vin
,C.FirstName
,C.LastName
,C.AccountNum
,D.DealerShipName
,Contrt.MaturityDate
,VS.GroundedDate
,V.[Year]
,VMkL.VehicleMakeDesc
,VMdL.ModelDesc
FROM Vehicle V
Inner Join ContractInfo contrt ON Contrt.VehicleID = V.VehicleID
Left Join DealerShips D ON v.ManufacturerID = D.ManufacturerID
Inner Join Customer C ON Contrt.CustomerID = C.CustomerID
Inner Join VehicleStatus VS ON Contrt.VehicleID = VS.VehicleID
Left Join ManufacturerMakeModel mmm ON v.MakeID = mmm.makeID
left Join VehicleMakeLookUp vmkl ON mmm.MakeID =
vmkl.VehicleMakeID
left Join VehicleModelLookup VMdl ON mmm.ModelID =
VMdl.ModelID
WHERE
((@Year IS NULL ) OR (V.Year=@Year))
and
(( @make = 0 ) OR (VMkL.VehicleMakeDesc=@make))
and
(( @Model = 0 ) OR (VMdL.ModelDesc=@Model))
END
And when I exectue (right click on the stored proc in management studio
and pick the exectue option) this with out providing any values to the
Year, Make and Model I am getting this error
**********************************Error*****************************************************
Msg 201, Level 16, State 4, Procedure USP_SearchVehicleOnYMM, Line 0
Procedure or Function 'USP_SearchVehicleOnYMM' expects parameter
'@Year', which was not supplied.
(1 row(s) affected)
***************************************************************************************************
Could some one please fix this error and have me understand where I am doing wrong?
Thanks
-L
|
|
|
|
|
Specifying a default value for parameters
ALTER PROCEDURE [dbo].[USP_SearchVehicleOnYMM]
@Year char(4)=NULL,
@Make int=NULL,
@Model int=NULL
AS
....
|
|
|
|
|
Hey it helped me Thank you.
|
|
|
|
|
Hi
I am trying to Execute an SSIS Package from C# Dot Net.
Below the code i am using.
try
{
Application app = new Application();
Package package = app.LoadPackage("DTSPackage/WinServeMonitoring.dtsx", null);
DTSExecResult result = package.Execute();
label1.Text = "Package Execution " + result.ToString();
}
catch (Exception exp)
{
label1.Text = exp.Message.ToString();
}
I have added reffrence for DTS Run time (using Microsoft.SqlServer.Dts.Runtime;)
But I am getting an Error like this
Error 1 'Application' is an ambiguous reference between 'System.Windows.Forms.Application' and 'Microsoft.SqlServer.Dts.Runtime.Application' C:\Documents and Settings\vahqmd10\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 23 17 WindowsApplication1
Error 2 'Application' is an ambiguous reference between 'System.Windows.Forms.Application' and 'Microsoft.SqlServer.Dts.Runtime.Application' C:\Documents and Settings\vahqmd10\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 23 39 WindowsApplication1
Error 3 The type 'System.Windows.Forms.Application' has no constructors defined C:\Documents and Settings\vahqmd10\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 23 35 WindowsApplication1
Can any one Help me !
Regards
Deepu M.I
|
|
|
|
|
I create a triggers but I need to add the time
how can I get the time NOW from sql server
thanks
dadax
|
|
|
|
|
GetDate() will return the current date and time. It is easy enough to just get the time portion from the returned DateTime
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
I have a table contain ( username,password )
and I'll save that password encrypted in the database
how can I do this ?
thanks
dadax
|
|
|
|
|
Encrypt the password first and then save it in the database like anything else.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
How can I encrypt it ?
( from SQL )
dadax
|
|
|
|
|
MohamadJaber wrote: How can I encrypt it ?
( from SQL )
As I already said "Encrypt the password first" then put it in SQL. You cannot encrypt it in SQL without using extended stored procedures in SQL Server 2000 or using CLR stored procedures in SQL Server 2005. Either which way the encryption process does not happen in SQL code.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
sorry annoyance you but plz can you tell how can I enrypted and decrypted it using CLR stored procedures in SQL Server 2005
thanks anyway for you help
dadax
|
|
|
|
|
You don't want to do that anyway. From a security standpoint, there's practically no value of encrypting passwords on the server if you transmit them over plaintext SQL. Anyone with a packet logger (easy) can get as many passwords as they could by finding an admin password and reading them out of your DB (hard).
|
|
|
|
|
Here u got good example how to hash password
http://www.c-sharpcorner.com/Code/2003/Feb/HashPassword.asp
|
|
|
|
|
You don't need CLR stored procs to encrypt or decrypt. SQL 2005 has encryption built in. Take a look at my blog at http://www.cubido.at/Blog/tabid/176/EntryID/34/Default.aspx. There you can find an example including a mind map describing SQL 2005 encryption functions.
Regards,
Rainer.
Rainer Stropek
Visit my blog at http://www.cubido.at/Blog/tabid/176/BlogID/4/Default.aspx
|
|
|
|
|
hi
What is the query to take value stored in variable
this value comes from textbox control and then datagrid is filtered through this value
Thanks
|
|
|
|
|
Something like this:
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand();
da.SelectCommand.Connection = conn;
da.SelectCommand.CommandText = "SELECT * FROM MyTable WHERE filterColumn = @filterValue";
cmd.Parameters.Add("@filterValue", myTextBox.Text);
da.Fill(myDataSet);
Assumptions:
* You have an existing SqlConnection called conn
* The table is called MyTable
* You are filtering on a column called filterColumn
* You have a TextBox called myTextBox
* You have a DataSet called myDataSet
Does this help?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Thank You Mackay
It is working ....
Thank You once again..
|
|
|
|
|
Hi Friends
I have parent child tables.
Paretnt has 10 records
child has 30 records i.e. all parent records got 3 child records.
date field in child record is unique.
Now i want to fetch records like this
parent record with last two dates of child records
Note: date is not in sequece for child records. i.e. data in child table may be entered with the gaps of years or months
help me please.
Naveed Kamboh
|
|
|
|
|
"?Select top 2 child.date, parent.* from parent inner join child on parent.key = child.foreignkey order by child.date desc"
assumes parent has some field key that is used as 'foreignkey' in child to relate the proper records
|
|
|
|
|
Thanks Graham,
it just fetches 2 recodrds
while i need 2 recods from child for each parent record.
Please if you need more explination email us. thanks
Naveed Kamboh
|
|
|
|
|
Hi every body i get this exception when i try to execude my web???
An attempt to attach an auto-named database for file C:\Web2005\BallonShop\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Please did u know where is the problem ?
good bye thank's
|
|
|
|
|
I want to know how i can transfer data from one MS ACCESS table on one computer to another MS ACCESS table on another computer by using a phone line on each computer using VISUAL BASIC 6.0
Shoaib Hussain
|
|
|
|