DB Design :: Getting The List Of Database Names From Remote Server?
Nov 2, 2015
In our application we are copying data between 2 sqlserver databases using linked server. Say, sqlserver1 is source and sqlserver2 is destination, then, our application will be on sqlserver2 box and will copy data from sqlserver1 to sqlserver2.
User also need to choose from which database of sqlserver1, the data need to be copied. This data is our application data.. Nothing related to sqlserver database.
We are using the following query, to get the database names of the source sqlserver..
SELECT * FROM <linked server to dest db>.master.sys.databases
My questions is : is this query generic enough that works on all sqlserver versions?
Is the master database name of sqlserver configurable or its alwasys fixed as "master"?
View 4 Replies
ADVERTISEMENT
Apr 14, 2006
In the past, we had table names such as:
PurchaseOrders
SalesOrders
Now with SQL 2005, you can use schema namespaces, so it could become:
Purchasing.Orders
Sales.Orders
So essentially you can use exactly the SAME table names, in different schemas.
So... would you recommend to change to the last model, or just stay with the old way?
What is best practice?
One of the reasons why I ask this question is that I looked at the AdventureWorks sample database included with SQL Server 2005, and Microsoft is using:
Sales.SalesOrderDetail
Purchasing.PurchaseOrderDetail
etc...
Why not:
Sales.OrderDetail
Purchasing.OrderDetail
etc...
????????
View 1 Replies
View Related
Aug 31, 2005
How to get the list of table names in a SQL2005 database?
View 6 Replies
View Related
Aug 3, 2007
Can anybody tell me how to find out whether a particular column exists in any of the tables of a database and if it does, display the table names?
Thanks
View 3 Replies
View Related
May 5, 2004
Hi there,
I am trying to create a list of all the tables in one database and then list the size of each table. So for example I want to create a table with the table name and table size for one DB
E.g
Table1 1111KB
Table2 123300MB
Table3 120448KB
etc for all the tables in a particukar DB
I know there is a stored procedure to list the sizes: 'sp_spaceused' but not sure how to script all this together.
can anyone help please!!
From
NewToSQL
View 12 Replies
View Related
Mar 13, 2008
I want to get the names of the databases of the server using OleDbConnection in c# which i have to add in to a combobox.....the same task i achieved using SqlConnection where in there is a Class SqlClientCollectionNames...the code is as followsusing (SqlConnection connection =new SqlConnection("Data Source=server;User ID=username;Password=passwd")) { connection.Open(); DataTable myData = connection.GetSchema(SqlClientMetaDataCollectionNames.Databases); foreach (DataRow row in myData.Rows) comboBox1.Items.Add(row[0]); connection.Close();} but the same i did for OleDbConnection it is not working using (OleDbConnection connection =new OleDbConnection("Provider=SQLOLEDB;Data Source=server;User ID=username;Password=passwd"))
{
connection.Open();
DataTable myData = connection.GetSchema(SqlClientMetaDataCollectionNames.Databases);//no such method Databases present in OleDb namespace
foreach (DataRow row in myData.Rows)
comboBox1.Items.Add(row[0]);
connection.Close();
} is there any other way to do this using OleDbConnection........??Please help
View 2 Replies
View Related
Jun 30, 2005
hi,I need to display the system names which has sql Server installed. How it can be done in vb.net. Help me plzregardsSomu
View 1 Replies
View Related
Aug 9, 2013
I'm using the following syntax to extract a list of all the table names on a linked server:
EXEC sp_tables_ex
@table_server = MY_SERVER_NAME
It outputs a list of tables into 4 columns in the result window.Is there a way an can use this as a 'SELECT * FROM ... " command so that I can organize records, insert into, etc etc ?
View 3 Replies
View Related
Sep 16, 2015
I am sharing one sql query and o/p:
select distinct case
when LastStatusMessageIDName = 'Program completed with success' then 'Office 2013 SP1 Installed Successfully'
when LastExecutionResult = '2013' then 'Machine Does not have Office 2013'
when LastExecutionResult = '17023' then 'User cancelled installation'
when LastExecutionResult = '17302' then 'Application failed due to low disk space.'
[Code] .....
The below is the output for the given query,here i want to see only one comment value in my list and the count is also sum of all where comment should be Application will be installed once machine is online(Bold columns o/p)
Comment Machine Name
Application will be Installed once machine is Online 4
Application will be Installed once machine is Online 12
Application will be Installed once machine is Online 42
Application will be Installed once machine is Online 120
Machine Does not have Office 2013 25
User cancelled installation 32
Application failed due to low disk space 41
Office 2013 SP1 already Exist 60
I need o/p like below:in single line
Application will be Installed once machine is Online 178
Machine Does not have Office 2013 25
User cancelled installation 32
Application failed due to low disk space 41
Office 2013 SP1 already Exist 60
View 2 Replies
View Related
Feb 14, 2008
Hi everyone!
I have a question regarding ASP.NET 2.0 reading available packages (calling "GetDtsServerPackageInfos" on the "Application"-Object which returns "Microsoft.SqlServer.Dts.Runtime.PackageInfos") from a remote SSIS server (not running them). It seems to me that I am experiencing either a security/delegation issue or that I am trying to do something that is not possible...
The setup is the following.
I have two machines, A and B. A runs IIS 6/ASP.NET 2.0 and B runs SQL Server and SSIS. They belong to the same domain. IIS runs the application pool with the webapplication in question under the "Network Service" account and A is trusted for delegation to B. At the moment its trusted when using Kerberos and for MSSQLSrvc and rpcss; but I tried "all" and many more as well.
I configured IE to use Windows Authentication and set the URL to belog to the Intranet (to enable kerberos authentication).
My ASP.NET webapplication now tries to read (in the sense explained above) the available packages on the SSIS machine (B). The packages are stored on the filesystem, not in mdsb. But I feel that this does not matter, since ASP.NET is accessing them through "the SSIS service" which can access packages in msdb or/and on the filesystem?
What happens now is that
a) everything works, when I fire up IE on A and access the webapplication. The user I have on A is a local admin.
b) I get "E_ACCESSDENIED" when I start IE as regular User on A
c) I get "E_ACCESSDENIED" when I access the webapplication from any other machine than A (IE6 or IE7)
My main question is: is it possible to do what I want to do? The other question is, why does everything work when I access the webapplication from A, but not from any other machine? The second thing makes me think it could be a delegation issue (double hop and SSIS don't seem to go togethe too well). But still, I could not find any resource telling me that this is impossible And frankly, I do not fully understand delegation and/or Kerberos.
I would greatly appreciate if anybody had a pointer or something for me.
Regards
scherand
Btw: Thanks to Caddre for his (her?) first help and pointing me to this forum.
View 20 Replies
View Related
Nov 26, 2002
Can anyone help me with a SQL statement that will list all the column names in a table please ?
I just want to list out the column name so that i can develop asp/vb more effectively than having to use SQLEM and Design table to see the field names.:confused:
thanks
FatherJack
View 2 Replies
View Related
Dec 13, 2004
I have been discussing with some coworkers whether or not it makes sense to invest the time to alphabetize the column names in our tables (aside from the PK and possibly FK's that could be listed first). My reasoning for doing so would make it much easier to scan the list of columns in a table that I was not familiar with to see if it contained a particular column (i.e. meeting_id). I was just wondering if this is common at all in our industry for new DB design (I realize why legacy systems would not be ordered in this way). I remember seeing MSFT designed their tables this way when Site Server first came out.
An argument was made that when you add a new column you would insert it into the appropriate location and in order to make this happen, EP needs to create a temp table, move the data and consequently lock the table until the data has been transferred. While this is correct, I do not see this negative as outweighing the positive experience achieved by scanning a list of fields in a table in a more orderly fashion.
Thoughts?
View 14 Replies
View Related
Mar 20, 2008
I know it is basics, just slipped out of my mind, How do we list or print the columns names of table in sql server 2000.
thanks,
View 10 Replies
View Related
Feb 24, 2011
I am using sql server 2005 enterprise edition.
How to list all the dimension and fact column names with mdx or tsql query...
View 9 Replies
View Related
Jan 19, 2008
Hi,
Is there any way to group variables present in a select statement.
My code:
SELECT @var1=something, @var2=something_else
FROM ...
GROUP BY @var1
I wanted to group by 'something' hence I used a variable to assign it to. But I'm unable to group it.
Any thoughts?
Thanks,
Subha
View 1 Replies
View Related
May 2, 2008
I have a scenario where I need to move a series of files from within a directory of many files. The files follow no nameing convention and are more of less random. However the file names never change from week to week. I tried various different options in a 'file system task', no go.
Any ideas on how to move only a list of files?
or
can I load only specific files into a 'Foreach Loop container' from a certain directory. I tried delimiting file names in the file source, that did not work.
Either way can work,
Thanks
View 1 Replies
View Related
Oct 28, 2007
Hi,
I am new to SSRS.
I have created simple report using reporting services, In which i am using one List element and inside that 8 text boxes and a table, in which 4 texboxes is used as lable and remain 4 textbos is value from dataset and table displays details as below for each unquie call number with table header marked in red color. When i click preview i get below report(Report 1) for call number 4 and 10 records in table which is under list. But for call number 4 still 6 records as to be display in next page with text boxe element which marked in Green color in Report 1. Now i am getting report with out List element i.e (Report 2 given below )
Report generated for Call numnber 4 (on click of preview ) (Report 1)
Generated Report
Call No
4
CallDate
2/2/2007
Customer Name
ZINDAL STEEL P . LTD
Address
Chennai
SL Number
PartNumber
PartName
Qty
Rate
Amount
1
12345
SCREWS
100
10
1000
2
47555
BOLTS
200
25
5000
3
125453
RIVETS
300
40
12000
4
15786
RATCHETS
500
23
11500
5
15566
TORQUE WRENCH
600
45
27000
10
5456
HARMONIZATION TOOL
700
45
31500
(Report 2)
Report generated for Same Call number 4 in next page with out List element, In this page i want display the same textboes and values which are marked in green color.(This 6 records alos belongs to same call Number 4 )
SL Number
PartNumber
PartName
Qty
Rate
Amount
11
12345
SCREWS 6"
100
10
1000
12
47555
BOLTS 5"
200
25
5000
13
125453
RIVETS 5"
300
40
12000
14
15786
RATCHETS Big
500
23
11500
15
15566
TORQUE WRENCH Small
600
45
27000
16
5456
HARMONIZATION TOOL
700
45
31500
Can any one please guide me how to do this kind of desing.
Thanks and regards
Manju
View 2 Replies
View Related
May 12, 2008
To maximize the number of names and phone numbers we can fit on a page, we'd like to have three or four columns of LastName, FirstName, Number on each page. The first column starts with the A's and goes down until the bottom of the page then goes back up to the top of the page in the second column. When the maximum number of columns (probably 3 or 4) is reached for one page, it starts again in the first column of the second page.
This is what we're looking for...
.style1
{width:83px;}
.style2
{width:77px;}
.style3
{width:65px;}
.style5
{width:82px;}
.style6
{width:79px;}
.style7
{width:62px;}
.style9
{width:71px;}
.style10
{width:70px;}
.style11
{width:113px;}
.style12
{width:129px;}
.style13
{width:70px;font-weight:bold;}
.style14
{width:71px;font-weight:bold;}
.style15
{width:129px;font-weight:bold;}
.style16
{width:62px;font-weight:bold;}
.style17
{width:79px;font-weight:bold;}
.style18
{width:82px;font-weight:bold;}
.style19
{width:113px;font-weight:bold;}
.style20
{width:65px;font-weight:bold;}
.style21
{width:77px;font-weight:bold;}
.style22
{width:83px;font-weight:bold;}
Page 1
LastName
FirstName
Number
LastName
FirstName
Number
LastName
FirstName
Number
Anderson
Fred
1234
Dalton
Mike
4567
Gladden
Tony
7890
Bailey
George
2345
Earl
Beth
5678
Hanks
Marideth
8901
Cox
Natalie
3456
Flake
Spencer
6789
Ingersol
Grace
9012
Page 2
LastName
FirstName
Number
LastName
FirstName
Number
LastName
FirstName
Number
Jackson
Frank
9234
Morrison
Ty
9567
Peters
Hank
9890
Klark
Missy
9345
Nickels
Al
9678
Quinn
Andy
9901
Little
Blake
9456
Oxnard
Will
9789
Rand
Phil
9112
Of course, it will take more rows of data to fill up a page, but this shows the basic idea of what we're trying to accomplish.
Does anyone know how to do this?
Thanks.
View 4 Replies
View Related
Aug 5, 2015
I am trying a create views that would join 2 tables:
Table 1: Has all the columns need by a view (
Name: Product
Structure: ID, Attribute 1, Attribute 2, Attribute 3, Attribute 4, Attribute 5 etc
Table 2: Is a lookup table that provides the names of columns
Name: lookupTable
Structure: tableName, ColumnName, columnValue
Values: Product, Attribute1, Color
Product, Attribute2, Size
Product, Attribute3, Flavor
Product, Attribute4, Shape
I want to create a view that looks like
ID, Color, Size, Flavor, Shape
View 4 Replies
View Related
Apr 9, 2008
ho w do i get all the database names from my local machine which are present in the sql sevrer 2005
i also need how do i get the names of all the tables,views,stored procedure names
in the particular database
View 3 Replies
View Related
Aug 26, 2015
I have a requirement to show Day of week in parameter drop down list in different order, actual order is Monday to Sunday (Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday) in DayOfWeek dimension in cube.
But my requirement is to show Friday to Thursday(Friday,Saturday,Sunday,Monday,Tuesday,Wednesday,Thursday) in DayOf Week parameter drop down list and report table. How I can get this requirement done.
View 2 Replies
View Related
Aug 4, 2015
I found this script online..
SELECT prin.[name] [User], sec.state_desc + ' ' + sec.permission_name [Permission]
FROM [sys].[database_permissions] sec
JOIN [sys].[database_principals] prin
ON sec.[grantee_principal_id] = prin.[principal_id]
WHERE sec.class = 0
ORDER BY [User], [Permission];
but the results are this: 2 columns - User and Permission
User Permission
User1 GRANT CONNECT
User2 GRANT CONNECT
IS there a way in SQL Server (2005/2008/2012) to run a script against a Database that will show all users that have permissions to that Database and the type of permissions?
View 7 Replies
View Related
Jun 15, 2015
I have a table called acc1152 with the field accno. depending on what the value of this field is, i need to replace it with a new value. These are the values i need to update
old value new value
7007 4007
7008 4008
4008 7
7009 4009
7011 4011
4011 ' '
7010 4010
4010 1
7016 4016
4016 1
4506 4006
4512 4012
how do I write one query that will accomplish this?
View 3 Replies
View Related
Jul 30, 2015
In SSMS, I connect Object Explorer to a partially contained database using a contained user login with password. This user has a database role of dbdatareader. When I try to expand the Tables in the database, I get the error:
The SELECT permission was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)
Is there a way to set permissions for the contained user so that this could be done?
View 4 Replies
View Related
May 13, 2015
I have a scenario like below
Product1
Product2 Product3
Product4 Product5
Product1 1
1 0 0
1
Product2 1
1 0 0
1
Product3 0
0 1 1
0
Product4 0
0 1 1
0
Product5 1
1 0 0
1
How to design tables in SQL Server for the above.
View 2 Replies
View Related
Jan 31, 2008
I'm going to be setting up DB mirroring between two SQL Server 2005 boxes. Since these are on two different servers, can the instance names be the same? Is there any reason NOT to do so if the mirror server is going to be used exclusively for DB mirroring?
For example: if the my primary DB is located on SERVER1INSTANCE1, can the mirror be SERVER2INSTANCE1 or do the instance names have to be different even though they're on different boxes.
Thanks!
View 4 Replies
View Related
Jan 11, 2007
HiI am facing a problem in designing a database for my project.Please help
I have hotel Information.The hotel allocates rooms for my company.This is done on weekly basis.
Now suppose in first week of a year the number of rooms allocated to the company is 3,2ndweek =5,3rdWeek=5 and so on...
So when i search based on a week i should have one result setIf i search based on MOnth i should have one result set.. in this way.
So what fields i need to take in a database table so that when i search based on week /month/quarter/year i get different resultsets.
View 6 Replies
View Related
Jul 22, 2015
The database has approx. 2500 temporary tables. The temp tables match a pattern such as APTMP... I tried deleting the tables in SSMS with the statement, Delete from Information_Schema.tables where substring(table_name,1,5) = 'APTMP' This returns the error message"Ad hoc updates to system catalogs are not allowed".
What is the correct way to delete a group of tables whose name match a pattern from within SSMS?
View 9 Replies
View Related
Apr 24, 2015
I'm using SQL Server 2012 and was attempting to move the msdb, model, and tempdb databases to a new location and accidentally gave their log files an mdf extension instead of ldf when providing the new pathfilename. After the server wouldn't start I checked my script and noticed my error. I have good backups of my system databases, so I was hoping to start the MSSQLSERVER service in single-user mode (using the -m startup parameter) and then just restore master using sqlcmd.
Unfortunately the service was starting but I couldn't connect via sqlcmd using any of the three protocols (it said the server was not found or not accessible each time). I also tried using the dedicated Admin connection but I got the same error. Then I went into the Templates folder and copied the master, msdb, model, and tempdb templates into the DATA folder and tried to restart SQL Server but still no luck (now the MSSQLSERVER service won't start at all). Is there an easy way to fix this mess without having to reinstall from the setup application?
View 8 Replies
View Related
May 28, 2015
I've been asked to create a new SQL server and restore an old server's DBs to the new server.
I'd like to generate a list of the DB names using powershell to distribute to their creators, in case some of these DBs are no longer needed.
View 2 Replies
View Related
Jun 27, 2006
I was wondering if anyone may be familiar with a way to create a dropdown list that included a list of SQLServers. Basically I want to create a little application that lets a user point to an instance of sql server, similar to enterprise manager. I wanted to use C# and figured there may be some namespaces I could use that provide this functionality but was not sure.
Thanks,
View 2 Replies
View Related
Jun 9, 2006
I use this macro to list in A column of sheet the name of sql server on
my lan.
Is possible to "scan server by server" and insert into column B the
name of database and related table?
Tks.
Sub test_sql()
Dim TEST As String
Dim RIGA As String
Set sqlApp = CreateObject("SQLDMO.Application")
Set serverList = sqlApp.ListAvailableSQLServers
numServers = serverList.Count
RIGA = 2
For I = 1 To numServers
TEST = serverList(I)
Range("A" + RIGA) = TEST
RIGA = RIGA + 1
Next
Set sqlApp = Nothing
End Sub
View 2 Replies
View Related
Jul 28, 2006
Hi
I have a database that stores all the data in one table that is only the data we are required to store hence it didnt require any other tables
the table has five colunms
Orderid, ordercost, orderdate, ordersystem, orderref
it is used in an web application that seraches for all the rest of the information using an orderid and displays the rest of the details the size of the table currently is about 123000 records that is increasing by 20000 every week.
i have an archive of the same data that has 7,666,000 records that are also going to be placed into the same database.
my question is is that a good idea of doing this?
are there any performance issues that i need to be aware of as currently the application runs quite quick?
View 15 Replies
View Related