PowerShell SQL Tutorial Part 1 : Fetching Data

preview_player
Показать описание
Learn how to create a database and then fetch the data from it using PowerShell. In this video we learn how to fetch data from a SQL Server with PowerShell, I also go over the basics of creating a database in SSMS and a simple table. In this series we will see how to also insert, update and delete from the database, iterate through the results of a fetch and how to create a SQL Module to allow us to log our scripts into a database.

create table Log(
id bigint identity,
occuredAt datetime default CURRENT_TIMESTAMP,
appName nvarchar(100),
computerName nvarchar(255),
details text,
);

insert into Log (appName,computerName,details) values ('Test','TestComputer','TestDetails')

Tags:
Sql server, powershell, fetching data, powershell sql, powershell data science, automation, jacked programmer, scripting, coding, programming
Рекомендации по теме
Комментарии
Автор

Your PowerShell videos are very helpful. Learning a lot. Thank you!

annachristina
Автор

Bro thank you so much. I am currently going through your PowerShell 7 Tutorials for Beginners series although. I'll only be using PowerShell for SQL Server mostly dbatools module. I even watch your videos on my tablet at the gym on the running machine. Really, really helpful Merry Christmas and Happy New Year.

BalvinderSingh-uhmy
Автор

Good instructions. Quick question, can I still use the dataset to look at the data even after the sql connection is closed? ....or do I need to throw that into a variable first? Thx

straycats
Автор

I noticed that the SqlAdpter.fill() method executes the whole SqlCommand you pass to it, no matter if it is just a SELECT or e.g. an UPDATE instruction. Sems odd - why not use it for every CRUD action?

ManuelBerfelde
Автор

Could you please make a series on PowerShell PostgreSQL please?

thrinathkumar
Автор

What’s your opinion on invoke-sqlcmd from the sql module?

ManuelBerfelde