|
I am using SQL Server 2000 as my DB and 2003 is my Dev environment. I wanted to know is there any method by which I can get number of parameters in any give Stored procedure.
-Krishnaraj
|
|
|
|
|
I am not expert, so I don't know exectly but I'll tell you that I think. Ok?
If you use
exec sp_helptext 'StoredProcedureName'
you'll get the Text . Using that text you can count your parameter. Have a nice job.
!alien!
|
|
|
|
|
There is a better way than the one already suggested.
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_NAME='StoredProcedureName'
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Thank you, it’s a great information.
But earlier I did it with the below code. Can you make any suggestion on this. My actual intention was to check whether particular column exists in sp’s parameter list.
Declare @Id as numeric
Select @Id = id from sysobjects where name like '%SP_Name%'
Select * from syscolumns where name like 'Column_Name' and Id =@id
Krishnaraj
|
|
|
|
|
That sould be more efficient if you did WHERE name = 'SP_Name'
Let's say you have a two stored procedures called GetData and GetDataForUser . You want to find the number of parameters for GetData . Using the code you supplied you can't tell if it will return the parameters for GetData or GetDataForUser because you gave it wild cards which say that you are looking for a procedure with GetData somewhere in the name.
I would suggest that the INFORMATION_SCHEMA.PARAMETERS way is easier to work with. If you examine the properties of the view itself, you'll see that it is just using sysobjects and syscolumns as well.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Yes, you are right, I just checked by running both queries simultaneously and I found that the code you have suggested executed faster then mine.
Thanks a lot…..
Krishnaraj
|
|
|
|
|
Thank you very much.
Your code is also helpful to me.
!alien!
|
|
|
|
|
Hi!
When I change connectionstring(server changes)in run time my crystal report does not work and I neet to change in crystal report in design time. I want to fix it. How do I fix it.
If possiable,Please give me two example.
One for SQL Server Authentication and another for Windows Authentication.
Please someone help me.
!Thank!
!alien!
|
|
|
|
|
i had the same problem but u can connect using ODBC and from ODBC u can change the path or the link to the dataBase
|
|
|
|
|
Do we have any key word or special word "ADMINISTRATOR" in VB6.0
|
|
|
|
|
No, why?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I have created a new font file. I want change the font in the title bar with that font, but I do not like to change Display Properties or create a custom title bar. How can I do this
Please help me
Thank you,
chatura
|
|
|
|
|
You can't. Those are the only two options you have.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
OK, thank you for saving my time.
chatura
|
|
|
|
|
Hello!
I got an answer from Dave but whatever I tried didn't wotk out to solve PInvokeStackImbalance problem. I am using VS 2005. Eventough I changed the Integers in the GetshortPath declaration below I still got the same problem.
I have included the code below. If you can see the problem, please let me know.
Thanks!
<dllimport("kernel32.dll", setlasterror:="True," charset:="CharSet.Auto)"> _
Public Shared Function GetShortPathName(ByVal longPath As String, <marshalas(unmanagedtype.lptstr)> ByVal ShortPath As StringBuilder, <marshalas(unmanagedtype.u4)> ByVal bufferSize As Integer) As Integer
End Function
Private Function GetDosPath(ByVal LongPath As String) As String
Dim sb As New StringBuilder(1024)
On Error Resume Next '++
Dim retVal As Integer = Interop.GetShortPathName(longPath, sb, 1024) '<-- error occurs at that line
If retVal <> 0 Then
Dim sTemp As String = sb.ToString()
GetDosPath = sTemp
Else
Console.WriteLine("Error occured. GetLastError returns {0}.", Marshal.GetLastWin32Error())
End If
End Function
|
|
|
|
|
You've supplied everything except the one piece we need - the original C function header!
Is this the GetShortPathName in the WIn32 Api??? If so, then the Declare should look like this (from PInvoke.net):
<DllImport("kernel32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Public Shared Function GetShortPathName(ByVal longPath As String, _
<MarshalAs(UnmanagedType.LPTStr)> ByVal ShortPath As StringBuilder, _
<MarshalAs(UnmanagedType.U4)> ByVal bufferSize As Integer) As Integer
End Function
Private Sub TestShortPath()
Dim sb As New StringBuilder(1024)
Dim longPath As String
Dim sFileName As String
longPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
Dim retVal As Integer = Interop.GetShortPathName(longPath, sb, 1024)
If retVal <> 0 Then
Dim sTemp As String = sb.ToString()
MessageBox.Show(sTemp)
Else
Console.WriteLine("Error occured. GetLastError returns {0}.", Marshal.GetLastWin32Error())
End If
End Sub
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 13:31 Sunday 5th February, 2006
|
|
|
|
|
Sorry Dave! Here is the class header.. Whatever I tried I got the same problem...
Public Class Interop
<dllimport("kernel32.dll", setlasterror:="True," charset:="CharSet.Auto)"> _
Public Shared Function GetShortPathName(ByVal longPath As String, <marshalas(unmanagedtype.lptstr)> ByVal ShortPath As StringBuilder, <marshalas(unmanagedtype.u4)> ByVal bufferSize As Integer) As Integer
End Function
End Class
|
|
|
|
|
No, no, no, ... The original C function header that you're trying to call, not what you think the VB declaration should be.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
GetShortPathName
The GetShortPathName function retrieves the short path form of the specified path.
DWORD GetShortPathName(
LPCTSTR lpszLongPath,
LPTSTR lpszShortPath,
DWORD cchBuffer
);
Parameters
lpszLongPath
[in] Pointer to a null-terminated path string. The function retrieves the short form of this path.
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.
Windows Me/98/95: This string must not exceed MAX_PATH characters.
lpszShortPath
[out] Pointer to a buffer to receive the null-terminated short form of the path specified by lpszLongPath.
cchBuffer
[in] Size of the buffer pointed to by lpszShortPath, in TCHARs.
Return Values
If the function succeeds, the return value is the length, in TCHARs, of the string copied to lpszShortPath, not including the terminating null character.
If the lpszShortPath buffer is too small to contain the path, the return value is the size of the buffer, in TCHARs, required to hold the path. Therefore, if the return value is greater than cchBuffer, call the function again with a buffer that is large enough to hold the path.
If the function fails for any other reason, the return value is zero. To get extended error information, call GetLastError.
|
|
|
|
|
This looks like it came out of MSDN. In that case, I've already shown you what the VB.NET declaration should look like.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Please help me. How do i randomly select a value, any value. Is there a method for this?
rzvme
|
|
|
|
|
These will get a random value that is >=0 and <1. To get any more specific code you have to ask a more specific question.
VB:
Randomize<br />
x = Rnd()
VB.NET:
Dim r as New Random()<br />
x = r.NextDouble()
---
b { font-weight: normal; }
|
|
|
|
|
well i need an integer value from 1 to 101!
rzvme
|
|
|
|
|
Well, that is quite more specific.
VB:
Randomize<br />
x = Int(Rnd() * 101) + 1
VB.NET:
Dim r as New Random()<br />
x = r.Next(101) + 1
---
b { font-weight: normal; }
|
|
|
|
|