Showing posts with label retrive. Show all posts
Showing posts with label retrive. Show all posts

Friday, March 9, 2012

how to retrive the value of "@DerivedFileName"

SqlCommand sqlCommand =newSqlCommand(spName, Conn);

sqlCommand.CommandType =CommandType.StoredProcedure;

sqlCommand.Parameters.Add("@.XMLString",SqlDbType.Xml).Value = XMLstring;

sqlCommand.Parameters["@.XMLString"].Direction =ParameterDirection.Input;

sqlCommand.Parameters.Add("@.DerivedFileName",SqlDbType.VarChar,50);

sqlCommand.Parameters["@.DerivedFileName"].Direction =ParameterDirection.Output;

int test = sqlCommand.ExecuteNonQuery();

Use

str = sqlCommand.Parameters["@.DerivedFileName"].Value.ToString();

how to retrive the names of sql servers running in a network through an vb6 application

I want to retrive the names of sql servers running in a network through an vb6 application .

I found a API which list out the SQL server names in the network , but I am able to connect only to the main

SQL server in the network and for other instances it gives error " DBNETLIB] Connection Open () SQL server doesn?ˉt exist or access denied"

Can anyone help me?

Thanks

Goldie

hy dear

i am also woking in scenario, can you plz tell me which API you are using...

|||You can write a WMI script to read the registry. Instance names can be found in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL/InstalledInstances key

How to Retrive single data from sqldatasource control

hi,

i need to code for retrieving single data from sqldatasource control. i need the full set of coding

connecting
retrieving data in text box
editing data to the table
updating data to the table
deleting data to the table

i want to fetch "single field data"

any one who know the code please post reply or send it to my mail senthilonline_foryou@.rediffmail.comI suggest that you use a stored procedure like this (assuming ID is an identity index column, with a data row NAME VARCHAR(50) in Table Fred)

CREATE PROCEDURE dbo.uspGetFred
(
@.ID INT,
@.NAME VARCHAR(50) OUTPUT
)
SET NOCOUNT ON
SELECT NAME FROM Fred WHERE ID = @.ID
GO

The VB code below retrieves NAME into aName fpor a given value of iID
CONST DBCONNECT As String = "Your Connect String"

Dim sName As String = ""
Dim xSqlConnection As SqlConnection = New SqlConnection(DBCONNECT )
Dim xSqlCommand As SqlCommand = New SqlCommand("uspGetFred", xSqlConnection)
Try
xSqlCommand.CommandType = CommandType.StoredProcedure
xSqlCommand.Parameters.Add("@.ID", SqlDbType.Int)
xSqlCommand.Parameters("@.ID").Value = CType(iId, Integer)
xSqlCommand.Parameters.Add("@.NAME", SqlDbType.VarChar, 50)
xSqlCommand.Parameters("@.NAME").Direction = ParameterDirection.Output
xSqlCommand.Connection.Open()
xSqlCommand.ExecuteNonQuery()
sName = xSqlCommand.Parameters("@.NAME").Value
Catch ex As Exception
' Handle your error here!
Finally
xSqlCommand.Connection.Close()
xSqlCommand.Dispose()
xSqlConnection.Dispose()
End Try

HTH!Idea

How to Retrive Dropped Procedures in SQL Server

Hi,
I had dropped a stored procedure from SQL Server DB.
Please let me know if there is any way retrive the dropped
procedures?
Please help me in finding the solution.
thanks,
athmaram
Well, do you ever take database backups? Do you ever store your procedure
code in source control of any kind? Keep local copies, even? How about the
same procedures from dev/test/staging environments?
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006
"Athmaram" <athmaramp@.gmail.com> wrote in message
news:1182814933.762281.75850@.e16g2000pri.googlegro ups.com...
> Hi,
> I had dropped a stored procedure from SQL Server DB.
>
> Please let me know if there is any way retrive the dropped
> procedures?
>
> Please help me in finding the solution.
>
> thanks,
> athmaram
>
|||Hello,
If you have a production staging or QA environment and if the procedure
version is same then pick from there. Or else restore the last days database
backup
with a new name and pick the procedure from there and create it in the
actual database.
Thanks
Hari
"Athmaram" <athmaramp@.gmail.com> wrote in message
news:1182814933.762281.75850@.e16g2000pri.googlegro ups.com...
> Hi,
> I had dropped a stored procedure from SQL Server DB.
>
> Please let me know if there is any way retrive the dropped
> procedures?
>
> Please help me in finding the solution.
>
> thanks,
> athmaram
>

How to Retrive Dropped Procedures in SQL Server

Hi,
I had dropped a stored procedure from SQL Server DB.
Please let me know if there is any way retrive the dropped
procedures?
Please help me in finding the solution.
thanks,
athmaramWell, do you ever take database backups? Do you ever store your procedure
code in source control of any kind? Keep local copies, even? How about the
same procedures from dev/test/staging environments?
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006
"Athmaram" <athmaramp@.gmail.com> wrote in message
news:1182814933.762281.75850@.e16g2000pri.googlegroups.com...
> Hi,
> I had dropped a stored procedure from SQL Server DB.
>
> Please let me know if there is any way retrive the dropped
> procedures?
>
> Please help me in finding the solution.
>
> thanks,
> athmaram
>|||Hello,
If you have a production staging or QA environment and if the procedure
version is same then pick from there. Or else restore the last days database
backup
with a new name and pick the procedure from there and create it in the
actual database.
Thanks
Hari
"Athmaram" <athmaramp@.gmail.com> wrote in message
news:1182814933.762281.75850@.e16g2000pri.googlegroups.com...
> Hi,
> I had dropped a stored procedure from SQL Server DB.
>
> Please let me know if there is any way retrive the dropped
> procedures?
>
> Please help me in finding the solution.
>
> thanks,
> athmaram
>

How to Retrive Dropped Procedures in SQL Server

Hi,
I had dropped a stored procedure from SQL Server DB.
Please let me know if there is any way retrive the dropped
procedures?
Please help me in finding the solution.
thanks,
athmaramWell, do you ever take database backups? Do you ever store your procedure
code in source control of any kind? Keep local copies, even? How about the
same procedures from dev/test/staging environments?
--
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006
"Athmaram" <athmaramp@.gmail.com> wrote in message
news:1182814933.762281.75850@.e16g2000pri.googlegroups.com...
> Hi,
> I had dropped a stored procedure from SQL Server DB.
>
> Please let me know if there is any way retrive the dropped
> procedures?
>
> Please help me in finding the solution.
>
> thanks,
> athmaram
>|||Hello,
If you have a production staging or QA environment and if the procedure
version is same then pick from there. Or else restore the last days database
backup
with a new name and pick the procedure from there and create it in the
actual database.
Thanks
Hari
"Athmaram" <athmaramp@.gmail.com> wrote in message
news:1182814933.762281.75850@.e16g2000pri.googlegroups.com...
> Hi,
> I had dropped a stored procedure from SQL Server DB.
>
> Please let me know if there is any way retrive the dropped
> procedures?
>
> Please help me in finding the solution.
>
> thanks,
> athmaram
>

How To Retrive Data If There Are Large No. Of Datas In Table(by Minimum Time Conusum]

I Have One Module , In Which I Have To Find Perticular Person's Data .
It Is Easily To Get But Here Large No. Of Data I Have, I Know That It Is Possible But It Is Very Much Time Conusuming, So, Any Other Way To Retrive Value By Minimum Time Consuming

Reply As Soon As Possible
Thanks,
Rahul

Rahul_nadiad@.yahoo.com

Quote:

Originally Posted by RAHULPRAJAPATI

I Have One Module , In Which I Have To Find Perticular Person's Data .
It Is Easily To Get But Here Large No. Of Data I Have, I Know That It Is Possible But It Is Very Much Time Conusuming, So, Any Other Way To Retrive Value By Minimum Time Consuming

Reply As Soon As Possible
Thanks,
Rahul

Rahul_nadiad@.yahoo.com


Hi Rahul,
What is the module? How is the data stored ie what is the structure?|||

Quote:

Originally Posted by RAHULPRAJAPATI

I Have One Module , In Which I Have To Find Perticular Person's Data .
It Is Easily To Get But Here Large No. Of Data I Have, I Know That It Is Possible But It Is Very Much Time Conusuming, So, Any Other Way To Retrive Value By Minimum Time Consuming

Reply As Soon As Possible
Thanks,
Rahul

Rahul_nadiad@.yahoo.com


Hi there,

Please give a simple & clearer problem statement as it would ease in providing solution. Take care.

How To Retrive Data If There Are Large No. Of Datas In Table(by Minimum Time Conusum

MY PROJECT IS HOSPITAL MANAGEMENT SYSTEM
AND THERE ARE ABOUT 700 PATIENT DAILY VISIT THE HOSPITAL/ ADDING NEW PATIENT(LARGE HOSPITAL).
SO, LARGE NUMBER OF PATIENTS ARE THERE. NOW SUPPOSE AFTER FEW YEARS THERE ARE ABOUT 70000000 PATIENTS RECORDS IN DATABASE , THEN TO FETCHNIG SOME PATIENT'S DETAILS IS VERY TIME CONSUMING [ BY SELECT * FROM PATIENT]
THEN WHAT SHOULD I DO? ANY ONE HAVE ANY IDEA?

AND ONE MORE THING I WOULD LIKE TO KNOW THAT HOW THE IMAGES WILL STORE IN DATABASE ACCESS?
PLS REPLY SOON

RAHUL PRAJAPATI
rahul_nadiad@.yahoo.com

Quote:

Originally Posted by RAHULPRAJAPATI

MY PROJECT IS HOSPITAL MANAGEMENT SYSTEM
AND THERE ARE ABOUT 700 PATIENT DAILY VISIT THE HOSPITAL/ ADDING NEW PATIENT(LARGE HOSPITAL).
SO, LARGE NUMBER OF PATIENTS ARE THERE. NOW SUPPOSE AFTER FEW YEARS THERE ARE ABOUT 70000000 PATIENTS RECORDS IN DATABASE , THEN TO FETCHNIG SOME PATIENT'S DETAILS IS VERY TIME CONSUMING [ BY SELECT * FROM PATIENT]
THEN WHAT SHOULD I DO? ANY ONE HAVE ANY IDEA?

AND ONE MORE THING I WOULD LIKE TO KNOW THAT HOW THE IMAGES WILL STORE IN DATABASE ACCESS?
PLS REPLY SOON

RAHUL PRAJAPATI
rahul_nadiad@.yahoo.com


Hi there,

The structure of the database isteslf can play a major role is enabling fast access, heard of database normalization? Why not use database normalization to restructure your current database.

In relational database theory, normalization is the process of restructuring the logical data model of a database to eliminate redundancy, organize data efficiently, reduce repeating data and to reduce the potential for anomalies during data operations. Data normalization also may improve data consistency and simplify future extension of the logical data model. The formal classifications used for describing a relational database's level of normalization are called normal forms

Kindly refer to below link for further reading & understanding, hope it helps.

http://en.wikipedia.org/wiki/Database_normalization
You can use Binary large object (BLOB technique in order to be able to safe graphics and other related material in database.

Good luck & Take care.|||Hi Sashi,
I am also a newbie to these things.
My understanding is that, data normalization eases the adding the data and managing the constraints.
But normalisation results in more number of tables than without (or lower level of) normalisation.
So doesnt it mean that it slows the data access as it requires to join more number of tables.

Please correct me if I am wrong.

-Subhash.

Quote:

Originally Posted by sashi

Hi there,

The structure of the database isteslf can play a major role is enabling fast access, heard of database normalization? Why not use database normalization to restructure your current database.

In relational database theory, normalization is the process of restructuring the logical data model of a database to eliminate redundancy, organize data efficiently, reduce repeating data and to reduce the potential for anomalies during data operations. Data normalization also may improve data consistency and simplify future extension of the logical data model. The formal classifications used for describing a relational database's level of normalization are called normal forms

Kindly refer to below link for further reading & understanding, hope it helps.

http://en.wikipedia.org/wiki/Database_normalization
You can use Binary large object (BLOB technique in order to be able to safe graphics and other related material in database.

Good luck & Take care.

How to retrive data

How to retrive data from EXCL file by using SSRS.(My data is not sql server)

There are Excel drivers for both ODBC and OLE DB. Here's an example of an OLE DB connection string for Excel:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1"

Then you can select from sheets in the workbook:

SELECT * FROM [sheet1$]

How to retrive a value using a query string?

Hello,

I would like to keep some values as session variables while the user is loged in, but i am missing some part of how to implement it.

This is what I have:

<script runat="server"> Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Dim conn As SqlConnection Dim cmd As SqlCommand Dim cmdString As String = "SELECT users.username, users.password, users.FirstName, users.LastName, users.CompanyId, Company.CompanyName, users.SecurityLvl FROM users LEFT OUTER JOIN Company ON users.CompanyId = Company.CompanyId WHERE (users.password = @.Password) AND (users.username = @.Username)" conn = New SqlConnection("Data Source=GDB03SQL;Initial Catalog=GDBRemitance;Persist Security Info=True;User ID=remitance;Password=remitance") cmd = New SqlCommand(cmdString, conn) cmd.Parameters.Add("@.Username", SqlDbType.VarChar, 50) cmd.Parameters("@.Username").Value = Me.Login1.UserName cmd.Parameters.Add("@.Password", SqlDbType.VarChar, 50) cmd.Parameters("@.Password").Value = Me.Login1.Password conn.Open() Dim myReader As SqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection) If myReader.Read() Then FormsAuthentication.RedirectFromLoginPage(Me.Login1.UserName, False) Else 'Response.Write("Invalid credentials") End If myReader.Close() End Sub</script>
I would like to know how can I get now the "user.FirstName" and pass it to a session variable?
how should I code it?

thanks,

Inside your read have

Session["FirstName"]=myReader.getString(2)

Is there any reason that you're getting 7(I think) fields from the database and throwing them away?

Also, it's poor form to store unencrypted passwords in the database. At least use xor or something.

how to retrive a SP table inside a SP?

Hello, inside of my SP i want to execute another SP, something like:

EXEC

[dbo].[Forum_DeleteBoard] @.BoardID= @.DelBoardID

this function Forum_DeleteBoard returs one row with 3 columns as a table, how do i get the first column of that table into a variable so i can check if it was ok or not
(it returns just one row with 3 columns).

Columns it returns:
QResult , Threads , Answers

SELECT @.isok = QResult FROM EXEC [dbo].[Forum_DeleteBoard] @.BoardID= @.DelBoardID ?

or how do you get it?

Patrick

you can try to do it by creating temp table and next by do insert from your stored procedure into this temp table. Temp table have to have the same layout as returned table. and you can select value you need from this table.

If you can modify your second procedure try to modify it to return output parameters instead of table result set. It will be simple and much faster.

You can find information about both solutions in SQL help, but if you have a problem with it just post again.

Thanks

Wednesday, March 7, 2012

How to retrieve tables' name?

Hi,
I want to retrive all tables and views name from a database.
How can I do this?
GoodMorningSky wrote:
> Hi,
> I want to retrive all tables and views name from a database.
> How can I do this?
Select * from INFORMATION_SCHEMA.TABLES
Select * from INFORMATION_SCHEMA.VIEWS
David G.
|||INFORMATION_SCHEMA.TABLES returns both tables and views so only this view
needs to be accessed to return a list of both.
--tables and views
SELECT * FROM INFORMATION_SCHEMA.TABLES
--tables only
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
--views only
SELECT * FROM INFORMATION_SCHEMA.VIEWS
or
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'VIEW'
Hope this helps.
Dan Guzman
SQL Server MVP
"David G." <david_nospam@.nospam.com> wrote in message
news:OEJXuJ5mEHA.596@.TK2MSFTNGP11.phx.gbl...
> GoodMorningSky wrote:
> Select * from INFORMATION_SCHEMA.TABLES
> Select * from INFORMATION_SCHEMA.VIEWS
> --
> David G.
|||Select * from INFORMATION_SCHEMA.TABLES
Select * from INFORMATION_SCHEMA.VIEWS
"GoodMorningSky" wrote:

> Hi,
> I want to retrive all tables and views name from a database.
> How can I do this?
>
>
|||Dan Guzman wrote:[vbcol=seagreen]
> INFORMATION_SCHEMA.TABLES returns both tables and views so only this
> view needs to be accessed to return a list of both.
> --tables and views
> SELECT * FROM INFORMATION_SCHEMA.TABLES
> --tables only
> SELECT * FROM INFORMATION_SCHEMA.TABLES
> WHERE TABLE_TYPE = 'BASE TABLE'
> --views only
> SELECT * FROM INFORMATION_SCHEMA.VIEWS
> or
> SELECT * FROM INFORMATION_SCHEMA.TABLES
> WHERE TABLE_TYPE = 'VIEW'
>
> "David G." <david_nospam@.nospam.com> wrote in message
> news:OEJXuJ5mEHA.596@.TK2MSFTNGP11.phx.gbl...
Never even looked at the output... silly me. I'm so used to hitting the
system tables directly... Thanks for the clarification.
David Gugick
Imceda Software
www.imceda.com

How to retrieve tables' name?

Hi,
I want to retrive all tables and views name from a database.
How can I do this?GoodMorningSky wrote:
> Hi,
> I want to retrive all tables and views name from a database.
> How can I do this?
Select * from INFORMATION_SCHEMA.TABLES
Select * from INFORMATION_SCHEMA.VIEWS
--
David G.|||INFORMATION_SCHEMA.TABLES returns both tables and views so only this view
needs to be accessed to return a list of both.
--tables and views
SELECT * FROM INFORMATION_SCHEMA.TABLES
--tables only
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
--views only
SELECT * FROM INFORMATION_SCHEMA.VIEWS
or
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'VIEW'
--
Hope this helps.
Dan Guzman
SQL Server MVP
"David G." <david_nospam@.nospam.com> wrote in message
news:OEJXuJ5mEHA.596@.TK2MSFTNGP11.phx.gbl...
> GoodMorningSky wrote:
>> Hi,
>> I want to retrive all tables and views name from a database.
>> How can I do this?
> Select * from INFORMATION_SCHEMA.TABLES
> Select * from INFORMATION_SCHEMA.VIEWS
> --
> David G.|||Dan Guzman wrote:
> INFORMATION_SCHEMA.TABLES returns both tables and views so only this
> view needs to be accessed to return a list of both.
> --tables and views
> SELECT * FROM INFORMATION_SCHEMA.TABLES
> --tables only
> SELECT * FROM INFORMATION_SCHEMA.TABLES
> WHERE TABLE_TYPE = 'BASE TABLE'
> --views only
> SELECT * FROM INFORMATION_SCHEMA.VIEWS
> or
> SELECT * FROM INFORMATION_SCHEMA.TABLES
> WHERE TABLE_TYPE = 'VIEW'
>
> "David G." <david_nospam@.nospam.com> wrote in message
> news:OEJXuJ5mEHA.596@.TK2MSFTNGP11.phx.gbl...
>> GoodMorningSky wrote:
>> Hi,
>> I want to retrive all tables and views name from a database.
>> How can I do this?
>> Select * from INFORMATION_SCHEMA.TABLES
>> Select * from INFORMATION_SCHEMA.VIEWS
>> --
>> David G.
Never even looked at the output... silly me. I'm so used to hitting the
system tables directly... Thanks for the clarification.
--
David Gugick
Imceda Software
www.imceda.com|||Select * from INFORMATION_SCHEMA.TABLES
Select * from INFORMATION_SCHEMA.VIEWS
"GoodMorningSky" wrote:
> Hi,
> I want to retrive all tables and views name from a database.
> How can I do this?
>
>