Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
2.60/5 (2 votes)
This may be simple enough..But since I am new to powershell handling sql script,I am here with a question..

After getting connected to a database how can we retrieve all the schema's listed in that particular database? Can anyone provide me a sample script of achieving this??

Thanks...
Posted

1 solution

The TSQL end of this, where "database" is the name of database where would-be schemata reside:
USE [database]
SELECT * FROM INFROMATION_SCHEMA.SCHEMATA

Presumeably the powershell frontend might leverage BCP? I don't know.
 
Share this answer
 
Comments
Vysakh Venugopal 19-Jun-13 0:42am    
@RedDK:But I am in search of a powershell code for retrieving the schemas associated with a db..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900