Friday, March 30, 2012
MS sql sever connection string
Can anybody write a code and tell me how can i access a table called
KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields called
KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those fields
--
Message posted via http://www.sqlmonster.comHi,
Access the table:-
1. Login to QUERY analyzer by providing the user name password
2. From the database pane, select the database where the KF_STATUS table
resides
3. Write the below query
select KF_ID ,KF_DATE, KF_STATUS FROM KF_STATUS
4. Execute the query by pressing Control and E simulteneously. This will
give u result.
THnaks
Hari
SQL Server MVP
"gurvinder gill via SQLMonster.com" <forum@.nospam.SQLMonster.com> wrote in
message news:f68623ec640847c497a4e72817032580@.SQLMonster.com...
> Hi everybody
> Can anybody write a code and tell me how can i access a table called
> KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields
> called
> KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those
> fields
> --
> Message posted via http://www.sqlmonster.com
MS sql sever connection string
Can anybody write a code and tell me how can i access a table called
KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields called
KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those fields
Message posted via http://www.droptable.comHi,
Access the table:-
1. Login to QUERY analyzer by providing the user name password
2. From the database pane, select the database where the KF_STATUS table
resides
3. Write the below query
select KF_ID ,KF_DATE, KF_STATUS FROM KF_STATUS
4. Execute the query by pressing Control and E simulteneously. This will
give u result.
THnaks
Hari
SQL Server MVP
"gurvinder gill via droptable.com" <forum@.nospam.droptable.com> wrote in
message news:f68623ec640847c497a4e72817032580@.SQ
droptable.com...
> Hi everybody
> Can anybody write a code and tell me how can i access a table called
> KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields
> called
> KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those
> fields
> --
> Message posted via http://www.droptable.comsql
Wednesday, March 28, 2012
MS sql sever connection string
Can anybody write a code and tell me how can i access a table called
KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields called
KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those fields
Message posted via http://www.droptable.com
Hi,
Access the table:-
1. Login to QUERY analyzer by providing the user name password
2. From the database pane, select the database where the KF_STATUS table
resides
3. Write the below query
select KF_ID ,KF_DATE, KF_STATUS FROM KF_STATUS
4. Execute the query by pressing Control and E simulteneously. This will
give u result.
THnaks
Hari
SQL Server MVP
"gurvinder gill via droptable.com" <forum@.nospam.droptable.com> wrote in
message news:f68623ec640847c497a4e72817032580@.droptable.co m...
> Hi everybody
> Can anybody write a code and tell me how can i access a table called
> KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields
> called
> KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those
> fields
> --
> Message posted via http://www.droptable.com
MS SQL Sever 7 to SQL Server 2005 Migration
I would like to ask, is there any way i could migrate data on my SQL Server
7 to SQL Server 2005? Is there any available white paper or article regardin
g
this? Kindly refer one to me.
Thanks in advance.In upgrading from SQL 7 to SQL Server 2005 you have the option to perform
- in place upgrade (replace existing SQL, which is not best practices).
- side / by side upgrade (install an instance of SQL 2005 next to or on
another server)
- transfer databases using backup / restore
- transfer databases using Copy Database Wizard in SQL 2005
- transfer databases using attach /detach
- transfer logins / user defined error message / jobs ..using Copy
Database wizard or SQL Integration Services
On transfering data you will find a lot of interesting info on
www.microsoft.com/learning/sql which provides you with free e-learning on
SSIS.
(formerly known as DTS)
Have a look at SQL Upgrade Advisor (www.microsoft.com/sql) for a nice tool
that will analyze your SQL 2005.
Read all documents in there for know issues and migration issues.
Dandy Weyn
[MCSE-MCSA-MCDBA-MCDST-MCT Community Leader]
SQL Server Technologist
http://www.dandyman.net
Check my SQL Server Resource Pages at http://www.dandyman.net/sql
"lonskie1030" <lonskie1030@.discussions.microsoft.com> wrote in message
news:AD96303E-204F-4816-9E12-7644BF75CD2D@.microsoft.com...
> Hi,
> I would like to ask, is there any way i could migrate data on my SQL
> Server
> 7 to SQL Server 2005? Is there any available white paper or article
> regarding
> this? Kindly refer one to me.
> Thanks in advance.
>|||Thanks for your response. I already saw one at MS Site. Anyway, thanks again
..
"Dandy Weyn [Dandyman]" wrote:
> In upgrading from SQL 7 to SQL Server 2005 you have the option to perform
> - in place upgrade (replace existing SQL, which is not best practices).
> - side / by side upgrade (install an instance of SQL 2005 next to or on
> another server)
> - transfer databases using backup / restore
> - transfer databases using Copy Database Wizard in SQL 2005
> - transfer databases using attach /detach
> - transfer logins / user defined error message / jobs ..using Copy
> Database wizard or SQL Integration Services
> On transfering data you will find a lot of interesting info on
> www.microsoft.com/learning/sql which provides you with free e-learning on
> SSIS.
> (formerly known as DTS)
> Have a look at SQL Upgrade Advisor (www.microsoft.com/sql) for a nice tool
> that will analyze your SQL 2005.
> Read all documents in there for know issues and migration issues.
>
> --
> Dandy Weyn
> [MCSE-MCSA-MCDBA-MCDST-MCT Community Leader]
> SQL Server Technologist
> http://www.dandyman.net
> Check my SQL Server Resource Pages at http://www.dandyman.net/sql
> "lonskie1030" <lonskie1030@.discussions.microsoft.com> wrote in message
> news:AD96303E-204F-4816-9E12-7644BF75CD2D@.microsoft.com...
>
>
MS SQL sever 2000 string connection problem
The code given in the link below is for MS Access but I'm using MS SQL 2000, so i'm not sure of the syntax for the code provided below (string connectionString...)
Please help..thank u!!
http://www.asp.net/webmatrix/guidedtour/section91/bookrequestcontrol.aspx
string connectionString = @."Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\TempProjects\LibraryDatabase.mdb";
public void LoadRequestedBooks(){
try
{
string mySelectQuery = string.Format("SELECT books.* from books, requests where books.bid = requests.bid and requests.mid = {0}", Session["userid"]);
System.Data.OleDb.OleDbConnection myConnection = new System.Data.OleDb.OleDbConnection(connectionString);
System.Data.DataSet myDataSet = new System.Data.DataSet();
System.Data.OleDb.OleDbDataAdapter myOleDbDataAdapter = new System.Data.OleDb.OleDbDataAdapter(mySelectQuery, myConnection);
myOleDbDataAdapter.Fill(myDataSet);
DataGrid1.DataSource = myDataSet.Tables[0];
DataGrid1.DataBind();
myConnection.Close();
}
catch(Exception exp)
{
Label2.Text = "<br>Error: " + exp.Message + "<br>";
}
}Hi,
You may take a look at another section of the Web Matrix tutorial,
which is primarily focus on data access with SQL/MSDE Server:
http://asp.net/webmatrix/tour/section2/newconn.aspx
Colt|||hi again. thanks for the site, but my problem is the database is not storred locally. it's on the server. How should i change the syntax in the following code to suit MS Sql Server2000? Your help will be very much appreciated. Thank you.
string connectionString = @."Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\TempProjects\LibraryDatabase.mdb";
public void LoadRequestedBooks(){
try
{
string mySelectQuery = string.Format("SELECT books.* from books, requests where books.bid = requests.bid and requests.mid = {0}", Session["userid"]);
System.Data.OleDb.OleDbConnection myConnection = new System.Data.OleDb.OleDbConnection(connectionString);
System.Data.DataSet myDataSet = new System.Data.DataSet();
System.Data.OleDb.OleDbDataAdapter myOleDbDataAdapter = new System.Data.OleDb.OleDbDataAdapter(mySelectQuery, myConnection);
myOleDbDataAdapter.Fill(myDataSet);
DataGrid1.DataSource = myDataSet.Tables[0];
DataGrid1.DataBind();
myConnection.Close();
}
catch(Exception exp)
{
Label2.Text = "<br>Error: " + exp.Message + "<br>";
}
}|||Hi,
I see.. You can connect to a remote DB server by using its IP address,
E.g. "Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
FYI:http://www.connectionstrings.com
Colt
Monday, March 19, 2012
MS SQL Server
I have a lot of tables in a database on MS SQl Sever 7.0
if i want to find out if any tables are not being used by any application...
Like, A table is there and it is no longer is used, but how to find out if that is really not used by any front end applications or any BCP/BULKINSERT statements etc.
Is there any way ? will the profiles help?
Thanks for the answer
Subrahmanya BhatAs far as I know, there is no "Last Accessed" property of a table.
If you want to identify all un-used tables, you may consider to catch all tables with changing record counts in the first place. Make a UNION query of counts of all tables like
SELECT count(*), "Table 1" FROM [Table 1] UNION
SELECT count(*), "Table 2" FROM [Table 2] UNION
...
, make an initial count, and repeat this after a while.
All tables with stable record counts may be unused, or just static like domain tables. To distinguish between them, rename all those tables by adding something like XYZ to the name, and test all your applications. If you are lucky, you will get a list of "missing" tables, which are the static ones.
However, this is a difficult path with an unknown result. Maybe your applications do not report the missing table, but just disfunctioning. Or you don't have a complete list of all applications (including import or export functionality with some auxillary tables). So, my advise would be to let the database as it is.|||Use SQL Profiler to monitor the tables in question.
You will have to run it long enough to be confident that all applications have been active. I'd say at least a month in order to cover typical month-end processing.
blindman|||Thanks for the information provided(Both cunt(*) and profile)
hopefully i find out such tables in my database using these suggestions.
Yeah if there was a "Last Accessed" property that would have been great
i am just planning to use DoktirBlue's method to begin with
with a little different approach liek below,
DECLARE tables CURSOR FOR
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'user table' ( or some 'Tab%')
and open the cursor and from each table get the count(*) and insert in to a temp table
Just thinking in these lines , will see how far i will be successful.
Thanks for the help again
Sub rahmanya Bhat
Originally posted by DoktorBlue
As far as I know, there is no "Last Accessed" property of a table.
If you want to identify all un-used tables, you may consider to catch all tables with changing record counts in the first place. Make a UNION query of counts of all tables like
SELECT count(*), "Table 1" FROM [Table 1] UNION
SELECT count(*), "Table 2" FROM [Table 2] UNION
...
, make an initial count, and repeat this after a while.
All tables with stable record counts may be unused, or just static like domain tables. To distinguish between them, rename all those tables by adding something like XYZ to the name, and test all your applications. If you are lucky, you will get a list of "missing" tables, which are the static ones.
However, this is a difficult path with an unknown result. Maybe your applications do not report the missing table, but just disfunctioning. Or you don't have a complete list of all applications (including import or export functionality with some auxillary tables). So, my advise would be to let the database as it is.|||Its not necessary to use a cursor. For example, this query of the system tables could be used to insert data directly into a rowcount history table:
select sysobjects.name, sysindexes.rows
from sysobjects
inner join sysindexes on sysobjects.id = sysindexes.id and sysindexes.indid < 2
where sysobjects.type <> 'S'
You can expand on this to get a lot more functionality.
blindman|||bm, isn't your profiler option powerful enough? Anyway, thanks for your showing an easy way to get the row count. But, is this count always accurate. Isn't it saver to run a statistics update before like
dbcc updateusage
go
? Also, you should exclude this 'dtproperties' from your query.|||Yes, the Profiler option would be more thorough, but for a quick check against active tables (not lookup or reference tables!) the rowcount should be sufficient.
Update stats does need to be run in order to make 100% sure that the rowcount is accurate, though it should be accurate anyway. I do not use the SCHEMA objects much, since I normally query system tables directly, but I would guess that they reference the system tables too, and are therefor equally subject to rowcount errors if the statistics are out of date.|||along with dtproperties, we can also filter out everything else that comes with the server install by changing the bm's code to look like this:
select sysobjects.name, sysindexes.rows
from sysobjects
inner join sysindexes on sysobjects.id = sysindexes.id and sysindexes.indid < 2
where objectproperty(sysobjects.id, 'IsMSShipped') = 0