SQL Server How to Execute very large T-SQL file

This blog article shows you how to Execute very large T-SQL file, for example, the T-SQL file with 30GB. Maybe someone else has another way to execute it. For me, I did the following.

1. Download and install Git Application., https://git-scm.com/downloads.

2. Split the T-SQL by lines for example, 30000 lines a file using the split command as below.

“C:\Program Files\Git\usr\bin\split” xad.sql -l 30000

3. Download and install Sublime Text editor, https://www.sublimetext.com/3.

Open each split file and resave it using Sublime with the Save with Encoding option and select DOS (CP-437).

4. Create a batch, bat, file with the following content.

for %%G in (*.sql) do sqlcmd /S lServerName/d DatabaseName -E -i”%%G” >> Execucao.log

pause

When you run then you will see something like following.

Reference: https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-ver15?WT.mc_id=DP-MVP-36769

Posted in Uncategorized | Leave a comment

SQL Server How to Execute very large T-SQL file

This blog article shows you how to Execute very large T-SQL file, for example, the T-SQL file with 30GB. Maybe someone else has another way to execute it. For me, I did the following.

1. Download and install Git Application., https://git-scm.com/downloads.

2. Split the T-SQL by lines for example, 30000 lines a file using the split command as below.

“C:\Program Files\Git\usr\bin\split” xad.sql -l 30000

3. Download and install Sublime Text editor, https://www.sublimetext.com/3.

4. Create a batch, bat, file with the following content.

for %%G in (*.sql) do sqlcmd /S lServerName/d DatabaseName -E -i”%%G” >> Execucao.log

pause

When you run then you will see something like following.

Reference: https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-ver15?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged | Leave a comment

Power Automate Desktop Transfer data from Word

This blog article shows you one of the reasons you do not get the value from Microsoft Word file when you use Power Automated Desktop. When you look at this forum https://powerusers.microsoft.com/t5/Power-Automate-Desktop/Transfer-data-from-Word-to-Excel-using-PAD/td-p/881067?WT.mc_id=DP-MVP-36769. The 2 picture below is extracting from a youtube video https://www.youtube.com/watch?v=IQ_KpBC8fwo&t=1769s. You watch closely the guy in the video did not take the value from the table cell.

He was actually taking from a small field that he did not explain what was that.

Somehow, I managed to get my one working. You will never get the value using Table Cell like the one in the picture below I bet.

But you will get the value if you can get to the control like below.


What I have there is not just a table cell but a Plain Text Content Control that I got it from the Developer tab.

So that is how you can get the value in Word.

Video: https://youtu.be/KLwA5allb6o

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged , | Leave a comment

Blazor Call Web Api to Get Shared Folder Structure

This blog article shows you how to get the Shared folder structure at the Web Api backend. This short article expects you to know ASP.NET Blazor and ASP.NET Web Api basic. The flow of the simple application as below.

Blazor -> Web Api -> Shared Folder Structure -> Web Api (List<string>) -> Blazor

The Controller, Get as follow.

public List<string> Get()

{

    List<string> lst = new List<string>();

    DirectoryInfo di = new DirectoryInfo(@”\\localhost\rsit”);

    lst = WalkDirectoryTree(di);

    return lst;

}

The below is the actual method to get the folder structure.

static List<string> WalkDirectoryTree(System.IO.DirectoryInfo root)

{

    System.Collections.Specialized.StringCollection log = new System.Collections.Specialized.StringCollection();

    System.IO.FileInfo[] files = null;

    System.IO.DirectoryInfo[] subDirs = null;

    List<string> lst = new List<string>();

    lst = null;

    try

    {

        files = root.GetFiles(“*.*”);

    }

    catch (UnauthorizedAccessException e)

    {

        log.Add(e.Message);

    }

    catch (System.IO.DirectoryNotFoundException e)

    {

        Console.WriteLine(e.Message);

    }

    if (files != null)

    {

        subDirs = root.GetDirectories();

        lst = new List<string>();

        foreach (System.IO.DirectoryInfo dirInfo in subDirs)

        {

            lst.Add(dirInfo.FullName);

            WalkDirectoryTree(dirInfo);

        }

    }

    return lst;

}

Put this code in the Blazor service. Make sure your port is 52939, if you change your port then you need to change your code as well.

public async Task<List<string>> GetDir()

{

    var url = @”http://localhost:52939/api/values&#8221;;

    var client = new HttpClient();

    List<string> lst = new List<string>();

    var result = await client.GetAsync(url);

    lst = await result.Content.ReadAsAsync<List<string>>();

    return lst;

}

The last part of the code is Blazor UI.

protected async Task GetDir()

{

    lst = new List<string>();

    lst = await ForecastService.GetDir();

}

You need to first run the backend Web Api then run the frontend Blazor UI and click the Fetch Data page.


Source Code Download (Backend): https://github.com/chanmmn/WebApi/tree/master/WebAppLoopFloder?WT.mc_id=DP-MVP-36769

Source Code Download (Frontend): https://github.com/chanmmn/BlazorApp/tree/master/BlazorAppLoopFolder?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged | Leave a comment

ReadAsAsync is missing form HttpResponseMessage.Content

This blog article shows you one of the possible reasons you cannot find ReadAsAsync in HttpResponseMessage.Content. Let’s say you have a Blazor application. You realized the ReadAsAsync does not come out from Intellisense. The below ReadAsAsync cannot appear in your application.

Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution… in Visual Studio. Add Microsoft.AspNet.WebApi.Client.

Reference: https://visualstudiomagazine.com/Blogs/Tool-Tracker/2019/04/Pulling-Objects-from-Web-Services.aspx?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged | Leave a comment

.NET Framework 4.8 Cannot find object or property Windows Server 2016

When you install .NET Framework 4.8 Developer Pack in Windows Server 2016 then you might hit the following error “Cannot find object or property”. This blog article shows one of the possible ways to resolve this error.

I found the installer in the forum this resolved the error.

https://docs.microsoft.com/en-us/answers/questions/440811/net-framework-48-on-windows-server-2019-installati.html?WT.mc_id=DP-MVP-36769

Just in case Microsoft removes the link, I have a copy of the installer for now.

Download: https://1drv.ms/u/s!AuZYHSwsevw1ojx2NIgmUp5fdcA_?e=KloxV3?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged , | Leave a comment

Unable to run a WCF for Debug with Visual Studio 2022

This blog article shows you one way to debug the WCF Service in VS 2022. When you use Visual Studio 2022 to create a WCF Service Application and run. You will hit the error “Could not load file or assembly ‘Microsoft.Build.Framework, Version=15.1.0.0” https://developercommunity.visualstudio.com/t/Unable-to-run-a-WCF-for-Debug-with-Visua/1466057?from=email&space=8&q=visual+studio+2022+wcf?WT.mc_id=DP-MVP-36769.

For sure Microsoft needs to get this fix. At the meantime, you can do the following.

  1. Open .csproj file of your WCF Service Application Project. Note, it is .csproj file for example, WcfService1.csproj and not Web.config file.
  2. Add

<EnableWcfTestClientForSVC>False</EnableWcfTestClientForSVC>

Into

<WebProjectProperties>


  1. Run WCF.


  1. Create a Console client, preferable .NET Framework Console client. Add
    Service Reference…


  1. Add the usual C# code below.

Static void Main(string[] args)

{

    ServiceReference1.Service1Client svc = new ServiceReference1.Service1Client();

    string result = svc.GetData(2);

    Console.WriteLine(result);

}

  1. Run the Console App (make sure you don’t close the Web Browse that was open by WCF Service Application).


Reference: https://newbedev.com/wcf-how-to-disable-wcf-test-client?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet | Tagged , , | Leave a comment

8 Real-World Digital Transformation Lessons

Explore actionable insights drawn from organisations that have reinvented their businesses, products and processes to take advantage of new technologies and market conditions. This eBook, 8 Real-World Digital Transformation Lessons, details how to meet customer expectations more effectively with digital transformation strategies grounded in real-life success stories.

Read this eBook to discover how to:

  • Lead with purpose to attract the employees and customers you want.
  • Build a culture that encourages smart risk-taking.
  • Unite data, technology and the business to spur innovation.

Ebbok download:

https://bit.ly/3gWmYWW

(I am not sure how long Microsoft will leave the link alive).

Posted in .Net, Cloud, Community, Computers and Internet, CTO, Data Platform | Tagged | Leave a comment

Add Swagger to Web Api Project

This blog article shows you how to add Swagger to Web Api project in Visual Studio. Web Api for .NET Core will add Swagger if you select support OpenApi when creating the project but not Web Api for .NET Framework. Create a Web Api Project https://youtu.be/KbNgAS4FQAs.Below is the default folder structure for .NET Fraework Web Api Project.

To add Swagger go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution… Go to Browse then type Swagger. Do not take the one below. That is the wrong one.

Choose the Swashbuckle. Click Install.

You will then find the SwaggerConfig.cs file with the code below.

GlobalConfiguration.Configuration

.EnableSwagger(c =>

{

c.SingleApiVersion(“v1”, “WebAppSwagger”);

})

.EnableSwaggerUi(c =>

{

});

Type Swagger at the
of http://loccalhost:55178 you will see the swagger running as below. Beware your point likely will not be 55178.

Posted in .Net, Cloud, Community, Computers and Internet | Tagged , | Leave a comment

Repair the corrupted ascii text file

This blog article shows you how to repair the corrupted ascii text file. Maybe you can find a better way then do let me know. When you open a text file in Notepad++ and it shows like the screen below inn Notepad++.

To fix this.

  1. First, try to open the file in WordPad.
  2. Save the file into docx.
  3. Start Microsoft Word. File -> Open choose Browse.

  1. Select the file you want to repair then select Open and Repair.

  1. Save the file to txt. Select US-ASCII.

Try to open again in Notepad++.

Reference: https://www.youtube.com/watch?v=Ey_O5sOW63U?WT.mc_id=DP-MVP-36769

Posted in .Net, Cloud, Community, Computers and Internet, Operating System | Leave a comment