SQL Command To Show Only Databases That Contain A Particular Table
Dec 5, 2007
I have several databases that are used to collect data for different
client-projects. My intention was to collect the data, and administer
mySQL so each client could see only their data. Each of these
databases used to collect data have the same tables. There are other
databases which are available to all the users which contain common
information.
The command "show databases" lists all of the databases (visible to
the particular user) and not the one's I would like to display (the
databases used to collect data). Is there a way to nest a single
mySQL command to show only the databases that have the same particular
table?
View 1 Replies
ADVERTISEMENT
Mar 22, 2004
I want to ask something because i need.
Any SQL/T-SQL command inside MsSQL Server 2000 can show the description of {all table columns or specified table columns} of specified table inside specified database?
can you teach me how to do and any example(s)?
View 2 Replies
View Related
Dec 11, 2005
Hi
Please can someone help me with a problem im having.
I have a site which allows users to place adverts, they can place as many as they like.
In dreamweaver I have managed to set up a site which now works fine in testing (early stages), a user can log in with "user" and "password".
I wowuld like to know how it can be done so that when a user logs in, it shows them how many adverts they have running.
Example:
Live adverts = "?"
I can only get as far as knowing that I need to use "count" in the command, how do I do it so it shows only the advertiser who has logged in their results
Thanks
View 7 Replies
View Related
Feb 19, 2008
Hi Guys,
well as you can see from my thread SQLServer is new to me i am used to mysql and i c'ant find the equivalent anywhere on the net... Seams easy enough but i have been at it for 6 hrs and i give up... I am just making a quick database view tool. So please tell me.
How do i load the all tables of a database via an sql command?
Since it took me a while to find this i thought migth as well slap ip somewhere so here is the command to load all data bases... In any case worked for me so...
- > select * from master.dbo.sysdatabases;
And where in the ... can you find a reference to all sql server commands? ... Please.
Thanks for your help
View 4 Replies
View Related
Nov 14, 2007
Hi all,
Criteria:
We connect to the remote database servers through the network from loca by using Query Analyzer.
Previously we were able to execute the xp_cmdshell command from local Query Analyzer to fetch the remote databases data.
But now we are unable to execute the xp_cmdshell command on remote databases from local Query Analyzer
We do not know what happened but i think due to network updates this command is not able to execute...
For ex:
Previously i was able to execute master..xp_cmdshell 'net start' from local Query Analyzer.But now not able to execute
Now my question is, is there any other way(Directly or indirectly) to execute the xp_cmdshell command on remote databases from local?
Note : we are able to execute this command on remote Query Analyzer but not from local QA
Any suggestions would be very very helpful to me?
Thanks in advance,
View 6 Replies
View Related
Aug 2, 2006
Hallo
i have two tables, MainTable and MainTableAudit: the second one keeps DML auditing via triggers.
I'm trying to build a query to highlight changes occurred to fields between the MainTable record and its audited records in MainTableAudit, for example, let's suppose i entered an item with some wrong attributes, and edited it three times:
MainTable record contains the latest and current version
ID002|Hitchhikers Guide to the Galaxy|Sci-fi|240 pages
MainTableAudit contains edited ID002 versions
ID002|Hitchhikers Guide to the Galaxy|Sci-fi|232 pages|2006-07-08 08:32:12
ID002|Hitchhikers Guide to the Galaxy|Sci-fi|212 pages|2006-05-08 10:54:02
ID002|Hitchhikers Guide to Galaxy|Sci-fi|222 pages|2006-07-04 11:42:16
I would like to build a report like this:
first insertion: Hitchhikers Guide to Galaxy|Sci-fi|222 pages
modified on 2006-07-04 11:42:16: field "Title" changed from "Hitchhikers Guide to Galaxy" to "Hitchhikers Guide to the Galaxy", field "PageNo" changed from "222" to "212"
modified on 2006-05-08 10:54:02: field "PageNo" changed from "212" to "232"
modified on 2006-07-08 08:32:12: field "PageNo" changed from "232" to "240"
current version: Hitchhikers Guide to the Galaxy|Sci-fi|240 pages
i'd prefer to use T-SQL and keep all into a single place (a view or storedprocedure), or at least to use reporting services; btw i would like to avoid coding web pages or hosted applications.
View 1 Replies
View Related
Jul 31, 2007
I am using the default ASPNETDB.MDF database for a project in SSE 2005 and VWD 2005. I need to use the UserName field from the aspnet_Users table as a foreign key in another table I have in the database. I am doing this so that I can grab data generated from additional fields that I'm adding to the membership registration wizard. However, I am obviously missing some steps since the user name doesn't show up in my second table. What should I do besides creating a relationship between the two fields and tables? Should I be writing some sort of SQL statement to accomplish this?
View 6 Replies
View Related
May 18, 2004
HI
I have created a stored procedure in SQL Server which outputs all records in a table.
How can I execute that procedure in access please? ( show that table in access?)
View 1 Replies
View Related
Jun 8, 2007
Hi,
We have a report published to two report servers ( same configuration). this report displays data in two side by side tables. on server 1, the left side table does not get displayed where as both the tables show fine on server 2.
What could be the reason for this
Any help greatly appreciated.
Thanks,
Phani
View 3 Replies
View Related
Feb 7, 2007
I would like to get single values from a huge sql server and put it into a table. let's say 4 by 4. How do I do that?
I have a connection string with a select statement that will only return a value. But, I do not know how to put that value into a table.
Thank you.
View 4 Replies
View Related
May 15, 2000
Hi all,
What is the best way to show when a table was last MODIFIED?
Thanks,
Stan
View 1 Replies
View Related
Jun 28, 2014
I have a table history of Employee data.
id | EmpNo | EmpName | MobileNo | Email | EmpSSS | UpdateDate | UpdateUser
I have to make a stored procedure that will show the history and changes made to a given EmpNo, with the UpdateDate, UpdateUser and indicate which field is modified. Ex. Employee Mobile number was changed from '134151235' to '23523657'.
Result must be:
EmpNo | UpdateDate | UpdateUser | Field changed | Change from | change to
View 4 Replies
View Related
Apr 25, 2014
I have a query
select salesId,count(*) from salesline group by salesid
Result will be
salesid Nos
----- ---
SO001 2
SO002 4
I want to display single record like below if there is no record available in the table
salesid Nos
So00? 0
View 1 Replies
View Related
Feb 15, 2007
I have two tables, Employee and Calls. They are joined on an Employee field. In my where clause I have a value specified that only returns specific calls. What I would like to have happen is to have the query return all Employee records regardless if any records from the Calls table is present for that employee. I want something that looks like this:Employee # of Calls
Employee A 5
Employee B 0
Employee C 10
When I apply a WHERE clause to the Calls table I get this:Employee # of Calls
Employee A 5
Employee C 10
I tried a LEFT OUTER JOIN without success. Any suggestions?
View 4 Replies
View Related
Jan 8, 2007
I'm trying to use the following code to examine table schema for SQL 2000. But when I do, the IsKey value is null or blank. I tried this on two different tables - a State table with a char(2) primary key containing the state abbreviation and a Trend table which has an identity column as the primary key. Public Shared Function GetSchema(ByVal sTable As String) As String
Dim sb As New StringBuilder
Dim oConn As SqlConnection = OpenConn()
Dim cmd As SqlCommand = New SqlCommand("SELECT * FROM " & sTable, oConn)
Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.SchemaOnly)
Dim dt As DataTable = dr.GetSchemaTable()
dr.Close()
oConn.Close()
For ic As Integer = 0 To dt.Columns.Count - 1
sb.Append(ic & ":" & CNull(dt.Columns(ic).ColumnName) & " ")
Next
sb.Append(vbCrLf)
For ir As Integer = 0 To dt.Rows.Count - 1
For ic As Integer = 0 To dt.Columns.Count - 1
sb.Append(ic & ":" & CNull(dt.Rows(ir).Item(ic).ToString) & " ")
Next
sb.Append(vbCrLf)
Next
Return sb.ToString
End Function
Here's the output from the function:
? datahelper.GetSchema("State")
"0:ColumnName 1:ColumnOrdinal 2:ColumnSize 3:NumericPrecision 4:NumericScale 5:IsUnique 6:IsKey 7:BaseServerName 8:BaseCatalogName 9:BaseColumnName 10:BaseSchemaName 11:BaseTableName 12:DataType 13:AllowDBNull 14:ProviderType 15:IsAliased 16:IsExpression 17:IsIdentity 18:IsAutoIncrement 19:IsRowVersion 20:IsHidden 21:IsLong 22:IsReadOnly 23:ProviderSpecificDataType 24:DataTypeName 25:XmlSchemaCollectionDatabase 26:XmlSchemaCollectionOwningSchema 27:XmlSchemaCollectionName 28:UdtAssemblyQualifiedName 29:NonVersionedProviderType
0:StateCode 1:0 2:2 3:255 4:255 5:False 6: 7: 8: 9:StateCode 10: 11: 12:System.String 13:False 14:3 15: 16: 17:False 18:False 19:False 20: 21:False 22:False 23:System.Data.SqlTypes.SqlString 24:char 25: 26: 27: 28: 29:3
0:State 1:1 2:50 3:255 4:255 5:False 6: 7: 8: 9:State 10: 11: 12:System.String 13:False 14:22 15: 16: 17:False 18:False 19:False 20: 21:False 22:False 23:System.Data.SqlTypes.SqlString 24:varchar 25: 26: 27: 28: 29:22
0:CountryCode 1:2 2:2 3:255 4:255 5:False 6: 7: 8: 9:CountryCode 10: 11: 12:System.String 13:False 14:3 15: 16: 17:False 18:False 19:False 20: 21:False 22:False 23:System.Data.SqlTypes.SqlString 24:char 25: 26: 27: 28: 29:3
"
? datahelper.GetSchema("Trend")
"0:ColumnName 1:ColumnOrdinal 2:ColumnSize 3:NumericPrecision 4:NumericScale 5:IsUnique 6:IsKey 7:BaseServerName 8:BaseCatalogName 9:BaseColumnName 10:BaseSchemaName 11:BaseTableName 12:DataType 13:AllowDBNull 14:ProviderType 15:IsAliased 16:IsExpression 17:IsIdentity 18:IsAutoIncrement 19:IsRowVersion 20:IsHidden 21:IsLong 22:IsReadOnly 23:ProviderSpecificDataType 24:DataTypeName 25:XmlSchemaCollectionDatabase 26:XmlSchemaCollectionOwningSchema 27:XmlSchemaCollectionName 28:UdtAssemblyQualifiedName 29:NonVersionedProviderType
0:TrendID 1:0 2:4 3:10 4:255 5:False 6: 7: 8: 9:TrendID 10: 11: 12:System.Int32 13:False 14:8 15: 16: 17:True 18:True 19:False 20: 21:False 22:True 23:System.Data.SqlTypes.SqlInt32 24:int 25: 26: 27: 28: 29:8
0:Description 1:1 2:50 3:255 4:255 5:False 6: 7: 8: 9:Description 10: 11: 12:System.String 13:False 14:22 15: 16: 17:False 18:False 19:False 20: 21:False 22:False 23:System.Data.SqlTypes.SqlString 24:varchar 25: 26: 27: 28: 29:22
0:Length 1:2 2:4 3:10 4:255 5:False 6: 7: 8: 9:Length 10: 11: 12:System.Int32 13:False 14:8 15: 16: 17:False 18:False 19:False 20: 21:False 22:False 23:System.Data.SqlTypes.SqlInt32 24:int 25: 26: 27: 28: 29:8
"
Column 6 is IsKey but just displays 6: whereas IsIdentity displays correctly for Column 17. Can someone help me? Thanks in advance.
View 1 Replies
View Related
Dec 7, 2005
Just like "describe select(*) from table_name" in DB2?
Thanks!
View 6 Replies
View Related
Sep 18, 2015
I have a table with some rows and columns what i want is i want to Show sum of particular column in the last row. This is my code.
SELECT DISTINCT Cluster.ClusterName, Gruppe.GruppeName, Arbeitspaket.ArbeitspaketName, BMWProjekt, AnzahlAP, Abgerechnet, InBearbeitung, Billanz FROM Bestellung
INNER JOIN Cluster ON Bestellung.Cluster = Cluster.rowid
INNER JOIN Arbeitspaket ON Bestellung.Arbeitspaket = Arbeitspaket.rowid
INNER JOIN Gruppe ON Bestellung.Gruppe = Gruppe.rowid
WHERE Projekt ="EA-284-Nxx" AND AnzahlAP <> 0 AND Abgerechnet is 1 AND InBearbeitung is NULL AND Billanz is NULL;
View 4 Replies
View Related
Jun 27, 2014
I have a table history of Employee data.
id | EmpNo | EmpName | MobileNo | Email | EmpSSS | UpdateDate | UpdateUser
I have to make a stored procedure that will show the history and changes made to a given EmpNo, with the UpdateDate, UpdateUser and indicate which field is modified. Ex. Employee Mobile number was changed from '134151235' to '23523657'.
Result must be:
EmpNo | UpdateDate | UpdateUser | Field changed | Change from | change to
View 4 Replies
View Related
Aug 18, 2014
How can I compare column in the same table and show only column and value that has been changed.
declare @t table (GroupID CHAR(6),Text1 VARCHAR(MAX),Text2 VARCHAR(MAX),Text3 VARCHAR(MAX))
insert into @t
SELECT '11111','Text1','Text2','Text3'
insert into @t
SELECT '11111','Text1','Text2','Text4'
END RESULTS:
Column Name Old New
Column 3 |'Text3' |'Text4'
View 9 Replies
View Related
Feb 5, 2007
Hi guys
I have a table which I need to analyze, what jobs this is working with, what stored procedure is calling this table etc. Is there any built-in function to show me or anybody know how to do it? This is my new job, and there are hundreds of stored procedures and jobs, do i really have to go thru one by one?
Please help.
Michelle
View 3 Replies
View Related
May 12, 2008
Hi, I have two queries as under:QUERY 1:SELECT * FROM OPENQUERY(MYSERVER, 'SELECT * FROM SCOPE() WHERE FREETEXT(''Text to Search'')') AS DocsQUERY 2:SELECT MediaID, LawID, LawDate, Agreement, Name, NameSearch, LawType, LawNo, RegID, IssueNo, AttachmentFrom Dept_LegalLawINNER JOIN Dept_LegalMinistries ON Dept_LegalLaw.RegID = Dept_LegalMinistries.RegIDINNER JOIN Dept_LegalLawType ON Dept_LegalLaw.LawID = Dept_LegalLawType.LawIDWHERE 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1both queries are working fine separately and I can generate the desired results separately, but I cannot merge them to get one single result for example, after a FREETEXT search I want to get some values from my local table (Query2) to display as one result. Like in Query1 FREETEXT will search the web page based on the given text and in Query2 will select the remaining data from the local database (Title, ID, Name etc etc).Try many thing but no success yet.Need urgent help.Thanks
View 2 Replies
View Related
Jul 9, 2013
I want my query to list all SSNS that have more than one record in the table. I have this query:
Code:
SELECT SSN, name4, count(*) from [1099_PER]
group by SSN, name4
having count(SSN) > 1
It does retrieve the right SSNS and tells me how many times the SSN occurs in the table. However, I want my query results to display their full records.
For example
SSN NAME4 COUNT
123445555 WALTER - 4
I want the query to show me all four records for this SSN. I thought removing the count field would do this, but it still gives me only one instance of each SSN.
View 6 Replies
View Related
Nov 28, 2014
Query that show me a Products Tables and its models, 1 product could have 2 or more models
Example Table Products
id Name
1 Product 1
2 Product 2
3 Product 3
Example Table Models
idmodel idproduct model
1 1 Model 1
2 1 Model 2
3 1 Model 3
4 2 Model 1
5 2 Model 2
6 3 Model 1
And I want to show:
Product Model
Product 1 Model 1
Model 2
Model 3
Product 2 Model 1
Model 2
Product 3 Model 1
How can I query to show that?
View 5 Replies
View Related
Jan 22, 2015
I do not understand why I have this issue.
SQL 2012 SP2, Transactional Replication.
I have added a new table to a database (existing publication) using T-SQL, I then opened up publisher properties, and ticked the new table/article so that it would be added to the subscriber. It did not show up.
I did not use a snapshot to initialize the subscription.
Immediate Synch is 0.
allow_anonymous is 0.
I mark the subscription to be reinitialized. When I start the snapshot agent I get '0% A snapshot was not generated because no subscriptions needed initialization'.
What could I be doing wrong, or missed out? Do I need to drop and recreate the subscription to get the article to show up?
View 0 Replies
View Related
May 20, 2012
I need to show the total amount of rows in a specific table?
The query is as follows:
As part of the planning process to expand the database that supports Northwind operations, the IT manager would like to know how many rows are currently in specific tables so that he can conduct capacity planning.
The results needed include two columns, TableName( containing all the tables in the database and Rows, which contain the total amount of all the rows per table).
View 4 Replies
View Related
Jan 8, 2007
I am using table object to present report.
table row1 has all the column names and table row2 has the data.
How can i put a horizontal line between column names and the data rows.
Thank you very much.
View 1 Replies
View Related
Apr 28, 2008
I'm getting the error message "The parameter is incorrect" when I'm trying to perform "Show Table Data" from the SQL Server Compact Edition" within VS 2008. Any ideas? Thank you in advance,
.
View 6 Replies
View Related
Apr 28, 2008
I'd like to hide/show a table based on selected parameters. In the current setup I have a matrix and two tables underneath that need to be displayed from time to time. First of I use a multi-value parameter called "Lieferart". Depending on the parameter I have set the visibility of the two tables with the following expression:
=iif(Parameters!lieferart.Value(0) like "Nagel%", False, True)
This expression doesn't work though, any ideas??? I am also unsure about what I have to do If multiple values from the parameter list are selected as Parameters!lieferart.value(0) doesn't necessarily need to have a label like "Nagel" included...
View 3 Replies
View Related
Jan 25, 2007
Hi all,
I'm having an interesting problem. In my report, I use a table to show my data set. The borders of the table are giving me a hard time...
The problem is, I'm not being able to display the bottom border for a row, but only at the end of the page, causing the table containing multi paged report data to be seen inside a box. Just to be clear;
I don't want to display borders of each row
I don't want to display table footer in each page (Only on last page)
I've already tried to display page footer, top border. Its not the answer :D
Thanks very much...
SMang
View 4 Replies
View Related
Nov 6, 2007
Hello,
We have a self-written procedure to restore transaction logs on a standby server (Sql Server 2000 sp4)
We do this by joining 2 msdb tables, to find out which backups have been performed: backupmediafamily and backupset.
Sometimes backups are NOT registred in table msdb..backupmediafamily.
Underneath 2 examples.
OK- underneath queries shows the time the backup was created in the physical_device_name; joined with media_set_id
99% shows these correct data
select media_set_id, physical_device_name from backupmediafamily where media_set_id = 258716
media_set_id physical_device_name
258716 H:Mssql2000MSSQLBACKUPPAPPS10_tlog_200701010030.TRN
select media_set_id, backup_start_date , backup_finish_date, database_name from backupset where media_set_id = 258716
media_set_id backup_start_date backup_finish_date database_name
258716 2007-01-01 00:30:08.000 2007-01-01 00:30:08.000 PAPPS10
NOT ok
select media_set_id, physical_device_name from backupmediafamily where media_set_id = 376467
media_set_id backup_start_date backup_finish_date database_name
376467 2007-02-17 09:00:14.000 2007-02-17 09:00:14.000 PDBTIME
376467 2007-10-31 19:15:05.000 2007-10-31 19:15:05.000 PJAVA
select media_set_id, backup_start_date , backup_finish_date, database_name from backupset where media_set_id = 376467
media_set id physical_device_name
376467 H:Mssql2000MSSQLBACKUPPDBTIME_tlog_200702170900.TRN
!!! No record for backup transaction log database PJAVA
select media_set_id, physical_device_name from backupmediafamily where physical_device_name like '%PJAVA%2007103119%'
media_set_id physical_device_name
1115347 H:Mssql2000MSSQLBACKUPPJAVA_tlog_200710311900.TRN
1115432 H:Mssql2000MSSQLBACKUPPJAVA_tlog_200710311930.TRN
1115475 H:Mssql2000MSSQLBACKUPPJAVA_tlog_200710311945.TRN
Missing record for backup made on 2007-10-31 19:15 hours !!!!
Hope somebody can help me.
Best regards,
hvdtol
View 11 Replies
View Related
Mar 27, 2008
Hi All,
I have following problem
please help me to resolve it.
There is table for shipping
as follows:
City
Kg
Rate(rs)
Rajkot
1
25.00
Rajkot
2
30.00
Rajkot
3
42.50
Ahemedabad
1
42.50
Ahemedabad
2
55.00
Ahemedabad
3
67.50
Ahemedabad
4
80.00
Goa
1
90.00
Goa
2
105.00
Goa
3
120.00
Gondal
1
25.00
Gondal
2
30.00
Gondal
3
42.50
Morbi
1
25.00
Morbi
2
30.00
Morbi
3
42.50
Gandhinagar
1
42.50
Gandhinagar
2
55.00
Gandhinagar
3
67.50
Gandhinagar
4
80.00
We need to display
the table in html page using any Asp.Net language.
The result table should be:
City(s)
1
2
3
4
Rajkot,Gondal,Morbi
25.00
30.00
42.50
-
Ahemedabad,Gandhinagar
42.50
55.00
67.50
80.00
Goa
90.00
105.00
120.00
-
Baruch
70.25
80.00
92.00
120.50
Description:
- Display all the cities
together for which all the shipping charges for (1-4) kgs are same. The range
of kgs is not fixed.
Reply as soon as possible.
Thanks
View 3 Replies
View Related
Nov 3, 1999
I do appreciat your help, I want to run a store procedure which will show 6 months . I do not know how to write the procedure, here in the notion in my mind, I want to be able to pass an input parameter (month) to the procedure which will then run a query to show 6 months prior the input parameter month, how can I do that, thanks for your help
Ali
View 2 Replies
View Related
Oct 25, 2013
I linked an SQL server table into Access, but when I open the table in Access, no data shows. Do I need to set some permissions on the sql table?
View 1 Replies
View Related