|
Hi,
Since the server is on the remote machine in that case How to do this,
Let me give an example suppose my server name is Foo and the instance name is Bar, IP address of the remote sever is ppp.qqq.rrr.sss
Can anyone tell me what would be the connection string.
RuchirDhar Dwivedi
Software Engineer
Windowmaker Software Pvt.Ltd.
Baroda, India.
|
|
|
|
|
|
Hi,
I have gone through that site but
To connect to SQL Server running on a remote computer (via an IP address)
oConn.Open "Provider=sqloledb;" & _
"Network Library=DBMSSOCN;" & _
"Data Source=xxx.xxx.xxx.xxx,1433;" & _
"Initial Catalog=myDatabaseName;" & _
"User ID=myUsername;" & _
"Password=myPassword"
in this example it doesn't provide any information about what to do in the case where I have a named instance.
Plz help??
RuchirDhar Dwivedi
Software Engineer
Windowmaker Software Pvt.Ltd.
Baroda, India.
|
|
|
|
|
I have n databases, each one has the same tables,Sure same tables in different databases has different values. I want to join them in a just one table in dataset. For example, i have 2 databases MB0001 and MB0002 , also a table named IntegratedChequeAccounts in two . I want to join two to one.
SELECT * FROM mb0001.DBO.IntegratedChequeAccounts
, Mb0002.DBO.IntegratedChequeAccounts
In this sample IntegratedChequeAccounts tables has 3 columns and each of them has 2 row. after running "select", i get 6columnsX4row as a table. But i desire 3columnsX4rows.
Any Idea to successed in.
|
|
|
|
|
|
Thanks for answer but i dont know why it is not working in my way.
I have a table named "DebitsAndCredits" which has fallowing columns
AccountNumber char(12)
DebitCredit bit
Amount money
I have the same table in two databases which are MB0001 and MB0002
I would like to join them in a one result set.I write
SELECT DISTINCT (AccountNumber ) ,
(SELECT SUM(Amount ) FROM DebitsAndCredits m
WHERE m.DebitCredit =0 AND m.AccountNumber =f.AccountNumber ) as Credit,,
(SELECT SUM(Amount ) FROM DebitsAndCredits m
WHERE m.DebitCredit =1 AND m.AccountNumber =f.AccountNumber ) as Debit
FROM DebitsAndCreditsf Order BY AccountNumber
UNION
SELECT DISTINCT (AccountNumber ) ,
(SELECT SUM(Amount ) FROM DebitsAndCredits m
WHERE m.DebitCredit =0 AND m.AccountNumber =f.AccountNumber ) as Credit,
(SELECT SUM(Amount ) FROM DebitsAndCredits m
WHERE m.DebitCredit =1 AND m.AccountNumber =f.AccountNumber ) as Debit
FROM DebitsAndCreditsf Order BY AccountNumber
What do u offer for me?
|
|
|
|
|
Try this:
SELECT AccountNumber,
SUM(CASE DebitCredit=0 THEN Amount ELSE 0 END) as Credit,
SUM(CASE DebitCredit=1 THEN Amount ELSE 0 END) as Debit
FROM MB0001..DebitsAndCredits
ORDER BY AccountNumber
GROUP BY AccountNumber
UNION
SELECT AccountNumber,
SUM(CASE DebitCredit=0 THEN Amount ELSE 0 END) as Credit,
SUM(CASE DebitCredit=1 THEN Amount ELSE 0 END) as Debit
FROM MB0002..DebitsAndCredits
GROUP BY AccountNumber
ORDER BY AccountNumber
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Hi all,
I have a problem for data transactions across two databases.
That is one object's data is comprised of two tables from
two different databases. I can perform rollback and commit within
one database. But for this case, how can I perform rollback and commit
across two databases(for two different SQL connections) for the object ?
Thanks
|
|
|
|
|
You need to use a two phase commit mechanism. What database are you using?
Database FAQ
|
|
|
|
|
I am trying to execute a crosstab query in SQL Server 2000, but alot of the columns display null values for every row. This is an example of what I am getting:
Test | Prompt | 0412-0001 | 0412-0002 | 0412-0003
-------------------------------------------------------
BTEX | Benzene | NULL | NULL | ND
ph VALUE | ph VALUE | NULL | NULL | 7
And what I want displayed is the following:
Test | Prompt | 0412-0003
-------------------------------
BTEX | Benzene | ND
ph VALUE | ph VALUE | 7
(I think the formatting is screwing up with the columns, but | indicates a column separator)
I am using the stored procedure found here:
http://www.sqlteam.com/item.asp?itemID=2955[^]
I do not know much about SQL programming and I was wondering if there is a way to modify this stored procedure to eliminate all columns that contain no data.
Nick
|
|
|
|
|
|
hi,dear buddies:
I have finished some instroductory books on SQL, but need some practice.
Do you guys have any suggestions on where I can find some good exerciese or quizs or real-world cases I can play with? OR any exercises based on the pre-installed database in SQL-server2000 (such as pub,northwind)?
Thanks a lot.
Waiting online !
Dennis
|
|
|
|
|
I currently strip out any quote marks from data input (and many other characters) when sending data to the database but would like the user to be able to enter quote marks if they wish.
I use mostly stored procedures to update data but often compose sql on the fly for ad hoc searching. Can anyone tell me how I should be handling the characters which are used in T-SQL such as ' and %
Thanks in advance - Dave
|
|
|
|
|
|
Nothing but porn on that link.
|
|
|
|
|
|
Can anyone tell me how can i read the DataTable of a Dataset..
Let's Say i used an adapter to access a dataset ,i put a query to the database (through the adapter)and the results are then stored in the Dataset's dataTable(after filling it)...How can i read the contents of the datatable(each row) and pass it to a parameter of mine..Let's Say i want to read each cell and return it to my String* Reader variable..
PLs help guys...It's an emergency..
Keep up the good work..
Thnx in advance
May it be your fate to live in interesting times
|
|
|
|
|
|
Thnx Colin.It does help a lot..
One more thing.I am working C++.Net and i want to organise the Connection to the database and the results of a specific SQL Statement through the adapter and the table in a single class... TO BE MORE SPECIFIC
#pragma once
class DBConn
{
public:
DBConn(void);
~DBConn(void);
public:
String* Type;
int Cost;
public:
String* FigureUserType(String* SenderNo)
{
SqlConnection * myConn = new SqlConnection(S"data source=(local);",S"integrated security=true;initial catalog=SMSCenter");
myConn->Open();
SqlDataAdapter * daResults = new SqlDataAdapter();
daResults->SelectCommand=new SqlCommand("SELECT Type FROM Subscribers WHERE PhoneNumber=@SenderNo",myConn);
SqlParameter* SenderParam=new SqlParameter();
//Set Parameter Properties
SenderParam = daResults->SelectCommand->Parameters->Add(
new SqlParameter("@SenderNo", SqlDbType::VarChar));
SenderParam->Value=SenderNo;
SenderParam->SourceVersion = DataRowVersion::Current;
//Create The Dataset to Fill
DataSet * dsresults = new DataSet();
//Fill the DataSet
daResults->Fill(dsresults,"Apotelesmata")
//Create The datarow
DataRow* drResults=new DataRow();
for(int i=0;>= dsResults->Tables->Item ["Apotelesmata"]->Rows->Count;i++)
{
myAuthorRow = myDataSet->Tables->Item["Apotelesmata"]->Rows->Item[i];
String* RetType=myAuthorRow->Item ["SenderNo"]->ToString ());
}
return RetType // Suppose we have only one Result
};
But I don't know where in the class i should declare the following...
using namespace System::Data; // Generic ADO.NET definitions, such as DataSet
using namespace System::Data::SqlClient; // SQL Server data provider definition
namespace system and so goes on...
PLS HELP
May it be your fate to live in interesting times
|
|
|
|
|
How can I do it? Please tell me.
Thank you
Nothing
|
|
|
|
|
|
I am using ADO.NET to access a SQL Server 2000 database in which there is a table Orders whose primary Key 'OID' is incremented automatically, so when I insert a new order I don't specify its OID. However, I need to know the OID of the inserted order to add items to it. Isn't there a function or something to do that ? Thank you.
Ahmed Said Hefny
Computer Engineering Student
Cairo University
|
|
|
|
|
You can use IDENT_CURRENT('table_name') to get the last automatically generated value inserted into the table that you specify.
Probably the best way to do this is to create a stored procedure to do the increment and then get the value
CREATE PROCEDURE InsertOrder
-- Set parameters for the values to be inserted here
AS
INSERT INTO Orders( column_names )
VALUES ( parameters containing the data to be inserted );
SELECT IDENT_CURRENT('Orders');
GO
Then in your .NET application you can use the SqlCommand.ExecuteScalar() to get the value out.
Does this help?
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Hi All,
I'm working on a c# application that suppose to store and retrieve images in the sql server database. By choosing a column of type image, it's size is defaulted to 16bytes but images usually are larger than that. How can I increase the size of an image column so that it can hold images of some 10+kb? Plz answer and oblige.
Thanks
|
|
|
|
|