Dynamic And Static On Algorithms
Feb 14, 2008
Hi All,
We're currently preparing for a project for a bank client of ours where we would be using SQL Server 2008's data mining capabilities.
In the context of the out-of-the-box algorithms of SQL08 does the algorithms Logistics, Clustering and Logistic Regression includes Dynamic Logistics, Dynamic Clustering and Dynamic Logistic Regression?
Regards,
Joseph
View 2 Replies
ADVERTISEMENT
Sep 26, 2006
dear experts,
i heard in a session, that the tables which are modifying continuously are known as dynamic tables.and which are not are known as static tables.
my question is how to find the statics to judge static and dynamic tables?
View 4 Replies
View Related
Dec 26, 2007
I have gotten mixed comments on this topic. I have a 64 bit machine running 64 windows 2003 standard and 64 SQL 2005 standard with 8 GB of RAM. We want to upgrade it to 32 GB. What is the best approach to do this? Dynamic or Stattic giving min and max server memory a value ? and if static what value should I use for 32 GB knowing that this box is only being used for SQL.
View 3 Replies
View Related
Dec 26, 2007
I have gotten mixed comments on this topic. I have a 64 bit machine running 64 windows 2003 standard and 64 SQL 2005 standard with 8 GB of RAM. We want to upgrade it to 32 GB. What is the best approach to do this? Dynamic or Stattic giving min and max server memory a value ? and if static what value should I use for 32 GB knowing that this box is only being used for SQL.
View 3 Replies
View Related
Aug 22, 2005
I want to distinguish between static SQL, dynamic SQL, and embeddedSQL, but couldn't find too much useful resources in the web.For example, if we put SQL statements (SELECT, INSERT, UPDATE, etc...)inside an application (e.g. Java application, VB application, etc...),do we consider those SQL statements as static SQL? or embedded SQL?How about dynamic SQL? any practical examples?Please advise. thanks!!
View 4 Replies
View Related
Apr 28, 2007
In one step of an SSIS package, i create an outgoing XLS filename based on the current datetime setting, a la:
"myFileName_" + (DT_WSTR,4)YEAR( getdate()) + RIGHT("0" + (DT_WSTR,2)MONTH( getdate()),2)+
RIGHT("0" + (DT_WSTR,2)DAY( getdate()),2) +
RIGHT("0" + (DT_WSTR,2)DATEPART("hh", getdate()),2) +
RIGHT("0" + (DT_WSTR,2)DATEPART("mi", getdate()),2) +
RIGHT("0" + (DT_WSTR,2)DATEPART("ss", getdate()),2) +".xls"
which provides the format as myFileName_yyyymmddhhmmss.xls.
This value is then assigned to a variable, user::myFilenameDateTime.
This variable is referred to in various steps which need the full pathname or filename.
I found, though, that in subsequent steps, the value for user::myFilenameDateTime is re-calculated whenever the variable is invoked.
So in one Task i created the physical output XLS file and named it "correctly", eg, myFileName_20070428090204.xls; in the next Task, i call a Stored Procedure in SQL Server 2005 to email the file with a corresponding message (that pulls in more data from the database).
The single Parameter to the Stored Procedure (that does the emailing) is the supposed/expected full Pathname of the outgoing file just produced but the parameter no longer represents the original filename -- and has changed slightly (a few seconds have been added) and the filename is now, myFileName_20070428090210.xls; consequently, my Email Distribution program cannot find the file with that specific name, although File = myFilename_20070428090204.xls does certainly exist.
so it appears that these variables are calculated realtime whenever encountered.
1) Am I misunderstanding something or misusing the variable assignment?
2) How can i keep << myFileName_yyyymmddhhmmss.xls >>, "static" throughout the duration of the overal SSIS Process.
3) I would think that even if I assign the derived myFileName value initially to ANOTHER "static" variable, this won't achieve anything because the new variable will be re-calculated again, as well, when it is invoked.
thx/spirits,
seth j hersh
View 3 Replies
View Related
Jun 15, 2007
Hi every one,
Could you please anyone tell me how to have static and dynamic columns in a matrix?
We can add static columns by right clicking detail text box and add column. But it will repeat for each column group. I need static columns in the dynamic columns level itself.
Thanks in advance!
View 3 Replies
View Related
Sep 9, 2015
I need to put a dynamic table (the amount of rows I control) into a static container (with a fixed size).
View 2 Replies
View Related
Apr 30, 2008
I'm trying to setup a dynamic ole db connection using the SA user ID, it has to be dynamic because the server name will change and it has to be SA because we're pulling information from system databases that some users don't have access to.
If I setup a regular static connection using SA credentials it works like a charm of course. When I create an expression to use the User:erver variable it doesn't work, it throws an error message saying that "The login failed for user sa" among other things, I'm thiking that the sa's password is not being saved.
Where exactly do I place a password for dynamic connections using sql server users? On the connection string? On the password property of the source? Any ideas?
View 1 Replies
View Related
Jul 19, 2007
Hi, all,
Thanks for your kind attention.
Just wonder is there any good idea for us to select attributes for training models? Both for non-supervised algorithms like Association Rules and Clustering etc. and supervised algorithms like decision tree etc.
It will be much interesting to hear from you for any best practices and popular methods of dealing with this issue.
I am looking forward to hearing from you and thanks for your advices.
With best regards,
Yours sincerely,
View 1 Replies
View Related
Feb 22, 2006
I'm using Delphi 2006 to create a DLL which will be integrated into SQL 2005. It's been a long road and I've made a lot of headway, however I am currently having the following problem creating the stored procedure:
My dll name is 'Crystal_Reports_Test_01'
In the DLL, my class is named 'Class01'.
In the DLL, my procedure is named 'TestMe'
I've managed to integrate the DLL into SQL using the following statement:
CREATE ASSEMBLY TEST_ERIC_01
AUTHORIZATION dbo
FROM 'c:mssqlassembliescrystalreports.dll'
WITH PERMISSION_SET = UNSAFE
I am attempting to create the stored procedure which points to the 'TestMe' method inside of the DLL. FYI: 'CrystalReports' is the namespace above my class that I had to add in order to get it to locate the class. The following code is used to create the stored procedure:
create procedure dbo.Crystal_Reports_Test_01(
@Parm1 nvarchar(255)
)
as external name TEST_ERIC_01.[CrystalReports.Class01].TestMe
But I get the following error:
Msg 6573, Level 16, State 1, Procedure Crystal_Reports_Test_01, Line 1Method, property or field 'TestMe' of class 'CrystalReports.Class01' in assembly 'CrystalReports' is not static.
I'm not sure what this means exactly. I think it means the method (the procedure) is not using Static method binding but should be. I have no idea what this really means or how to accomplish this in the DLL - or if I'm even going about this in the right way.
Any help would be appreciated ! I'll post the Delphi code (DLL) below.
Thanks,
Eric Gooden
library CrystalReports;uses System.Reflection, System.Runtime.InteropServices;...................type Class01 = class public procedure TestMe([MarshalAs(UnmanagedType.LPWStr)] var sVarString: wideString); export; end;procedure Class01.TestMe([MarshalAs(UnmanagedType.LPWStr)] var sVarString: wideString); export;begin sVarString:= 'Lets change the value and see if the stored proc. gets the change.';end;end.
View 4 Replies
View Related
Aug 19, 2015
I have some data in Excel - sheet1 which would be static.
Now I need to import data from SQL Server (using a query) and Union above static data with this SQL data and later I will have to create PowerPivot table in Sheet2.
Which is suitable option for me to import data from SQL to excel as I see "From SQL Server" option under "Data" and "Power Query" tab as well.
How to merge above SQL data with existing static data?
(SQL Server 2012)
View 6 Replies
View Related
Aug 24, 2007
Here is how you get the check digit for EAN-8, EAN-13 and EAN-14.CREATE FUNCTION dbo.fnGetEAN
(
@EAN VARCHAR(13)
)
RETURNS VARCHAR(14)
AS
BEGIN
DECLARE@Index TINYINT,
@Multiplier TINYINT,
@Sum TINYINT
SELECT@Index = LEN(@EAN),
@Multiplier = 3,
@Sum = 0
WHILE @Index > 0
SELECT@Sum = @Sum + @Multiplier * CAST(SUBSTRING(@EAN, @Index, 1) AS TINYINT),
@Multiplier = 4 - @Multiplier,
@Index = @Index - 1
RETURNCASE @Sum % 10
WHEN 0 THEN @EAN + '0'
ELSE @EAN + CAST(10 - @Sum % 10 AS CHAR(1))
END
END
E 12°55'05.25"
N 56°04'39.16"
View 1 Replies
View Related
Aug 24, 2007
Here is how you get the check digit for ISBN.CREATE FUNCTION dbo.fnGetISBN
(
@ISBN VARCHAR(11)
)
RETURNS VARCHAR(13)
AS
BEGIN
DECLARE@Index TINYINT,
@Weight TINYINT,
@Sum SMALLINT
SELECT@Index = LEN(@ISBN),
@Weight = 2,
@Sum = 0
WHILE @Index > 0
BEGIN
IF SUBSTRING(@ISBN, @Index, 1) <> '-'
SELECT@Sum = @Sum + @Weight * CAST(SUBSTRING(@ISBN, @Index, 1) AS TINYINT),
@Weight = @Weight + 1
SET @Index = @Index - 1
END
RETURNCASE @Sum % 11
WHEN 1 THEN @ISBN + '-X'
ELSE @ISBN + '-' + CONVERT(CHAR(1), 11 - (@Sum % 11))
END
END
E 12°55'05.25"
N 56°04'39.16"
View 2 Replies
View Related
Feb 5, 2007
I just want to know what are the data algorithms available for sql server 2005 and can i use data mining as a web service
View 1 Replies
View Related
Aug 2, 2006
I am in the stage of design for an application that uses SQL server 2005. We intended to encrypt some sensitve data using the encryption features in SQL server 2005. we will use symmetric key encryption. The question here is which symmetric encryption algorithm has the best performance? how much does the key size affect the perfromance? the data to be encrypted will be some lines of text equal to a word document.
any ideas?
View 1 Replies
View Related
Jun 9, 2007
Hello Everyone,
I am reading DataMining Tutorial and right now I am at the Mining Algorithms section. I cannot understand any of the algorithms. For example take the following text... what a bunch of mouthful bla bla bla it is ....
"The Microsoft Decision Trees algorithm supports both classification and regression and it works well for predictive modeling. Using the algorithm, you can predict both discrete and continuous attributes.
In building a model, the algorithm examines how each input attribute in the dataset affects the result of the predicted attribute, and then it uses the input attributes with the strongest relationship to create a series of splits, called nodes. As new nodes are added to the model, a tree structure begins to form. The top node of the tree describes the breakdown of the predicted attribute over the overall population. Each additional node is created based on the distribution of states of the predicted attribute as compared to the input attributes. If an input attribute is seen to cause the predicted attribute to favor one state over another, a new node is added to the model. The model continues to grow until none of the remaining attributes create a split that provides an improved prediction over the existing node. The model seeks to find a combination of attributes and their states that creates a disproportionate distribution of states in the predicted attribute, therefore allowing you to predict the outcome of the predicted attribute"
In the above text what is meant by discrete and continious attributes? what is regression? what is predicted attributes? what are input attributes? what is distribution of states?
Is there a source which explains these algorighms in a easier way ....
View 4 Replies
View Related
Dec 14, 2006
hi,
Is it possible to use two algorithms together?I need to write prediction Query so that its should both models having clustereing algorithm and timeseries algorithm.
for example
I am having student information.I ve to predict performance of students for certain period.The students should be classified by their types like rich kids,poorkids..like that.I need to predict the performance of the rich kids??
can anyone help?
View 1 Replies
View Related
Apr 3, 2008
Hi,
In the info for SQL Compact Edition 3.5 it states that one of the features is:
Support for newer and more secure encryption algorithms.
I can't seem to find details of exactly what these new, more secure algorithms are. It appears 3.1 used 128-bit RSA. Is this the same in 3.5, or has this changed?
Thanks
View 6 Replies
View Related
Mar 20, 2008
Can anybody answer this question ?
View 1 Replies
View Related
Jun 19, 2007
I was just wondering on what algorithms was used in the different feature buttons in the Excel Add-In? For example, forecast, what algorithm was used in order for it to create the forcasting?
View 1 Replies
View Related
May 22, 2006
Hi, all here,
I am having a question about plug-in algorithms in SQL Server 2005. Since we are able to implement our own algorithms in SQL Server 2005 analysis services architecture, so my question is: what benefits can to a great extent be achieved? Like say, we are going to implement a plug-in algorithm, so what considerations should be concerned?
Thanks a lot in advance for any guidance and help.
View 8 Replies
View Related
Jun 6, 2006
Hi, all here,
I am having a more considertaion about Data Mining plug-in algorithms. When we say we are going to embed a uesr plug-in algorithm, so what is the context for that ? I mean in which case then we thing we need to embed a user plug-in algortihm? I know when we say we are going to embed a user costomermized plug-in algorithm, it means we want something more costomized. But what kind of customized features are generally concerned? Is it independant for different market sectors?
I dont think we can just try to embed a plug-in algorithm then compete it with avaialble algorithms to see which one is with better prediction accuracy?
Would please someone here give me some guidances about that?
View 5 Replies
View Related
Nov 6, 2006
Hi,
I recently started using SQL 2000 Analysis Manager. I wanted to try data mining but was unable to get the Mining Model Wizard to load available techniques.
When I select a cube and "New Mining Model" I get the following error:
"Unable to get list of data mining algorithms."
"Object of provider is not capable of performing requested operation"
Please help.
Thank you very much,
Robert
View 4 Replies
View Related
May 11, 2007
Hi, all experts here,
Thank you for your kind attention.
Could please any of you give me some advices for if there are tutorials and demos avaiable which cover all the SQL Server 2005 data mining built-in algorithms?
That will be great to hear from any of you shortly. Thanks a lot in advance.
With best regards,
Yours sincerely,
View 8 Replies
View Related
Apr 25, 2007
I have the following stored procedure...
CREATE Procedure UserGetInfo2 (@UserID int, @SystemTimePeriodID int )As set nocount onSELECT Users.UserId as UserID, Users.UserName as UserName, Users.RealName as RealName, UserTimePeriod.BudgetCode as BudgetCode, UserTimePeriod.SystemTimePeriodID as SystemTimePeriodID, Users.Password as Password, Users.SSN as SSN, Users.Location as Location, Users.ScheduleType as ScheduleType, Users.EmployeeType as EmployeeType, Users.TimeAccounted as TimeAccountedFROM Users INNER JOIN UserTimePeriod ON Users.UserId = UserTimePeriod.UserIDWHERE (users.userID= @UserID) AND (UserTimePeriod.SystemTimePeriodID = @SystemTimePeriodID)returnGO
The problem lies in that when a person has a SystemTimePeriodID over a certain value, there is no UserTimePeriod record since it has not been created yet.
Obviously, I need to wrap this in an IF...EXISTS
IF EXISTS (SELECT UserTimePeriodID FROM UserTimePeriod WHERE (SystemTimePeriodID = @SystemTimePeriodID) AND (UserID = @UserID))
(the SELECT above, since that's what needs to come back if the data exists)
ELSE
Do the same select but put in a static value for BudgetCode, like '0000'
GO
How could I do the part where the IF...EXISTS fails?
I'm... not sure I can use RETURNS, since it feeds into this recordset:
rstUserInfo2.Open "UserGetInfo2 " & Request("UserID") & ", " & Request("SYSTIMEPERIODID")
and later uses values from that RecordSet, such as <td><%=rstUserInfo("BudgetCode") & ""%></td>
View 4 Replies
View Related
May 30, 2008
Hello,
I have a OLE DB on a Data Flow that execute a query and returns 5 columns i want to add a new column with a static value that a have on a Variable.
I use Derived Column in order to create the new column adding the variable value in the expression field, Is this the best way??
Thanks
View 4 Replies
View Related
Nov 10, 2006
I'm attemping to deploy a crypto class that we use on a desktop app to SQL Server. I'll use the encryptstring/decryptstring found in this class as User Defined Functions on SQL Server. When I try to deploy the class I'm getting this error:
Error 1 Method, property or field 'EncryptString' of class 'EncryptingDecryptingOASISPWDS.Crypto' in assembly 'EncryptingDecryptingOASISPWDS' is not static. EncryptingDecryptingOASISPWDS
Here is the code:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Imports System.Security.Cryptography
Imports System.Text 'for UnicodeEncoding
Imports System.IO 'for MemoryStream, FileStream, Stream, Path
Imports System.Threading 'for Thread.Sleep
Partial Public Class Crypto
'Private Const CodeVersion As String = "01.00.00"
'class member variables
Private m_sPassPhrase As String
'class private variables
Private mbytKey() As Byte 'crypto key
Private mbytIV() As Byte 'Initialization Vector
Private mbKeyIsSet As Boolean = False
Private mksKeyNotSetException As String = "Crypto passphrase is not set."
Private mksPassphraseTooSmall As String = "PassPhrase length must be at least {0} characters."
'--- class constructors
Public Sub New()
'no passphrase is useful for GetHashString/ValidPassword methods
End Sub
Public Sub New(ByVal CryptoPassPhrase As String)
PassPhrase = CryptoPassPhrase
End Sub
'--- class public properties
'generate and store encryption key & iv from passphrase
Public Property PassPhrase() As String
Get
Return m_sPassPhrase
End Get
Set(ByVal Value As String)
Const iMinLength As Integer = -1 '-1 disables min length
m_sPassPhrase = Value.Trim
'enforce a rule on minimum length if desired here
If (Value.Length > iMinLength) Or (iMinLength = -1) Then
Dim sha2 As New SHA256Managed()
'256 bits = 32 byte key
mbytKey = sha2.ComputeHash(BytesFromString(m_sPassPhrase))
'convert to Base64 for Initialization Vector, take last 16 chars
Dim sKey As String = Convert.ToBase64String(mbytKey)
mbytIV = Encoding.ASCII.GetBytes(sKey.Remove(0, sKey.Length - 16))
mbKeyIsSet = True
sha2 = Nothing
Else
mbKeyIsSet = False
Throw New Exception(String.Format(mksPassphraseTooSmall, (iMinLength + 1).ToString))
End If
End Set
End Property
'decrypt a stream
Public Function DecryptStream(ByVal EncryptedStream As MemoryStream) As MemoryStream
If mbKeyIsSet Then
Try
'create Crypto Service Provider, set key, transform and crypto stream
Dim oCSP As New RijndaelManaged()
oCSP.Key = mbytKey
oCSP.IV = mbytIV
Dim ct As ICryptoTransform = oCSP.CreateDecryptor()
Dim cs As CryptoStream = New CryptoStream(EncryptedStream, ct, CryptoStreamMode.Read)
'get bytes from encrypted stream
Dim byteArray(EncryptedStream.Length - 1) As Byte
Dim iBytesIn As Integer = cs.Read(byteArray, 0, EncryptedStream.Length)
cs.Close()
'create and write the decrypted output stream
Dim plainStream As New MemoryStream()
plainStream.Write(byteArray, 0, iBytesIn)
Return plainStream
Catch ex As Exception
Return Stream.Null
End Try
Else
Throw New Exception(mksKeyNotSetException)
End If
End Function
'decrypt a string - wrapper without Base64 flag (True by default)
Public Function DecryptString(ByVal EncryptedString As String) As String
Return _DecryptString(EncryptedString, True)
End Function
'decrypt a string - wrapper with Base64 flag
Public Function DecryptString(ByVal EncryptedString As String, ByVal Base64 As Boolean) As String
Return _DecryptString(EncryptedString, Base64)
End Function
'encrypt a stream
Public Function EncryptStream(ByVal PlainStream As MemoryStream) As MemoryStream
Try
'open stream for encrypted data
Dim encStream As New MemoryStream()
'create Crypto Service Provider, set key, transform and crypto stream
Dim oCSP As New RijndaelManaged()
oCSP.Key = mbytKey
oCSP.IV = mbytIV
Dim ct As ICryptoTransform = oCSP.CreateEncryptor()
Dim cs As CryptoStream = New CryptoStream(encStream, ct, CryptoStreamMode.Write)
'get input stream into byte array
Dim byteArray() As Byte = PlainStream.ToArray()
'write input bytes to crypto stream and close up
cs.Write(byteArray, 0, PlainStream.Length)
cs.FlushFinalBlock()
cs.Close()
Return encStream
Catch ex As Exception
Return Stream.Null
End Try
End Function
'encrypt a string - wrapper without Base64 flag (True by default)
<Microsoft.SqlServer.Server.SqlFunction()> _
Function EncryptString(ByVal PlainText As String) As String
Return _EncryptString(PlainText, True)
End Function
''encrypt a string - wrapper with Base64 flag
<Microsoft.SqlServer.Server.SqlFunction()> _
Public Function EncryptString2(ByVal PlainText As String, ByVal Base64 As Boolean) As String
Return _EncryptString(PlainText, Base64)
End Function
'calculates the hash of InputValue, returns a string
'- SHA1 hash is always 20 bytes (160 bits)
Public Function GetHashString(ByVal InputValue As String) As String
Try
Dim inputBytes() As Byte = BytesFromString(InputValue)
Dim hashValue() As Byte = New SHA1Managed().ComputeHash(inputBytes)
Return BytesToHexString(hashValue)
Catch ex As Exception
Return String.Empty
End Try
End Function
'returns True if hash of Passphrase matches HashValue
Public Function ValidPassword(ByVal Passphrase As String, ByVal HashValue As String) As Boolean
Return (GetHashString(Passphrase) = HashValue)
End Function
'internal string decryption
Private Function _DecryptString(ByVal EncryptedString As String, ByVal Base64 As Boolean) As String
Try
'put string in byte array depending on Base64 flag
Dim byteArray() As Byte
If Base64 Then
byteArray = Convert.FromBase64String(EncryptedString)
Else
byteArray = BytesFromString(EncryptedString)
End If
'create the streams, decrypt and return a string
Dim msEnc As New MemoryStream(byteArray)
Dim msPlain As MemoryStream = DecryptStream(msEnc)
Return BytesToString(msPlain.GetBuffer)
Catch ex As Exception
Return String.Empty
End Try
End Function
'internal string encryption
Private Function _EncryptString(ByVal PlainText As String, ByVal Base64 As Boolean) As String
Try
'put string in byte array
Dim byteArray() As Byte = BytesFromString(PlainText)
'create streams and encrypt
Dim msPlain As New MemoryStream(byteArray)
Dim msEnc As MemoryStream = EncryptStream(msPlain)
'return string depending on Base64 flag
If Base64 Then
Return Convert.ToBase64String(msEnc.ToArray)
Else
Return BytesToString(msEnc.ToArray)
End If
Catch ex As Exception
Return String.Empty
End Try
End Function
'returns a Unicode byte array from a string
Private Function BytesFromString(ByVal StringValue As String) As Byte()
Return (New UnicodeEncoding()).GetBytes(StringValue)
End Function
'returns a hex string from a byte array
Private Function BytesToHexString(ByVal byteArray() As Byte) As String
Dim sb As New StringBuilder(40)
Dim bValue As Byte
For Each bValue In byteArray
sb.AppendFormat(bValue.ToString("x2").ToUpper)
Next
Return sb.ToString
End Function
'returns a Unicode string from a byte array
Private Function BytesToString(ByVal byteArray() As Byte) As String
Return (New UnicodeEncoding()).GetString(byteArray)
End Function
'Return True when the file is available for writing
'- returns False if output file locked, for example
Private Function CheckWriteAccess(ByVal FileName As String) As Boolean
'2 second delay with 10,200
Dim iCount As Integer = 0 'retry count
Const iLimit As Integer = 10 'retries
Const iDelay As Integer = 200 'msec
While (iCount < iLimit)
Try
Dim fs As FileStream
fs = New FileStream(FileName, FileMode.Append, _
FileAccess.Write, FileShare.None)
fs.Close()
Return True
Catch ex As Exception
Thread.Sleep(iDelay)
Finally
iCount += 1
End Try
End While
Return False
End Function
End Class
View 4 Replies
View Related
May 29, 2008
Should a static connection be used in application. Is it advisable to use a static connection, i mean everytime should i create a new instance of sqlonnection object and then dispose it after use or should i use a static connection plz advise
View 2 Replies
View Related
Jun 12, 2008
Can I use this class in ASP.NET web site with many visitors?SqlLayer.cs: public static class SqlLayer{ public static string ConnectionString = ConfigurationManager.ConnectionStrings["SomeConnectionString"].ConnectionString; public static int ExecuteNonQuery(string StoredProcedureName, string[] ParamNames, object[] ParamValues) { if (ParamNames.Length != ParamValues.Length) { throw new Exception("ParamNames.Length != ParamValues.Length"); } using (SqlConnection cSqlConnection = new SqlConnection(ConnectionString) { cSqlConnection.Open(); SqlCommand cSqlCommand = cSqlConnection.CreateCommand(); cSqlCommand.CommandType = CommandType.StoredProcedure; cSqlCommand.CommandText = StoredProcedureName; cSqlCommand.Parameters.Add("@ReturnValue", DbType.Int32); cSqlCommand.Parameters["@ReturnValue"].Direction = ParameterDirection.ReturnValue; for (int i = 0; i < ParamValues.Length; i++) { cSqlCommand.Parameters.AddWithValue(ParamNames[i], ParamValues[i]); } cSqlCommand.ExecuteNonQuery(); return (int) cSqlCommand.Parameters["@ReturnValue"].Value; } } public delegate void ActionForReader(SqlDataReader Reader); public static void ExecuteReader(string StoredProcedureName, string[] ParamNames, object[] ParamValues, ActionForReader cActionForReader) { using (SqlConnection SqlConnection1 = new SqlConnection(ConnectionString)) { SqlConnection1.Open(); SqlCommand SqlCommand1 = SqlConnection1.CreateCommand(); SqlCommand1.CommandType = CommandType.StoredProcedure; SqlCommand1.CommandText = StoredProcedureName; for (int i = 0; i < ParamValues.Length; i++) { SqlCommand1.Parameters.AddWithValue(ParamNames[i], (ParamValues[i] == null ? DBNull.Value : ParamValues[i])); } using (SqlDataReader Reader = SqlCommand1.ExecuteReader()) { if (cActionForReader != null) { //if (Reader.HasRows == false) throw new Exception("Reader has no rows"); //if (Reader.RecordsAffected == 0) throw new Exception("Reader RecordsAffected = 0"); while (Reader.Read()) { if(Reader!=null) cActionForReader(Reader); } } } } }} Using: SqlLayer.ExecuteNonQuery("SomeStoredProcedure", "ID", ID);---------SqlLayer.ExecuteReader("SomeStoredProcedure", new string[]{"Param1","Param2"}, new object[]{Value1,Value2}, Action);...void ActionForForumCollection(SqlDataReader Reader) {LabelContent.Text += Reader[0].ToString()+" - "+Reader[1].ToString();}
View 1 Replies
View Related
Oct 17, 2006
Let's say I have a simple query to return the results of my "Status" table. The query reads as follows:
Code:
Select statusID, statusName
From Status
Here is the result set that I am returned:
Code:
22 Associate Member
23 Is Not Paying
24 Exempt
25 Fair Share
26 Member
29 Retiree
30 Staff
32 Fair Share - Self Pay
34 Member - Self Pay
Now, I am using this query for reporting purposes and would like to inject some additional sql that will append one additional row to my result set -- this is what I am calling the 'static' row in the thread title.
In other words, without modifying my database I would like to return the above set of data but with one additional row that has an arbitrary ID with the name "Unknown" or something similar.
again, I want to avoid adding an "Unknown" field directly to my database -- is their any way to "hard code" the selection of this row in my sequal?
Thanks,
Zoop
View 1 Replies
View Related
May 26, 2004
:confused: Please forgive this elementary question. I have database which has a view that produces the desired records and fields from multiple tables. As I understand it a view is a Virtual Table. My problem is I need to export these results periodically to deliver to a customer. I am running this database on SQL Server 2000 if I right click on a table I have the option to dts the data to a text file but when I right click on the view I do not have this option. How can I make this virtual table an actual table. PLEASE Help Thank You, Ed
View 1 Replies
View Related
Oct 12, 2007
I try to declare a variable with un static decimal point in the following statement:-
declare @mpt int;
declare @mpq nvarchar (1)
SELECT @mpq = (SELECT mpq FROM ims.parm)
exec('declare @MM1 decimal (10,'+ @mpq +');')
set @mm1 = 1
print @mpt
when i print the declare statement looks like the following:
declare @MM1 decimal (10,2);
but with exec the statement, I have the following error:-
Msg 137, Level 15, State 1, Line 18
Must declare the scalar variable "@mm1".
Best regards
View 2 Replies
View Related