IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to View Stored Procedure Code in SQL Server

The most common way to view the code of a stored procedure in SSMS is doing a right-click on the stored procedure and select Script Stored Procedure as and select CREATE To.

But this is not practical when you have several stored procedures to look at.

Another way to do it by using a script:

USE [DATABASENAME]
GO

EXEC sp_helptext STOREDPROCEDURENAME
GO

You might want to set the Results to Text for easy copy and paste for further editing.

Further Reading

How to view the stored procedure code in SQL Server Management Studio
How to Find a String in SQL Server Stored Procedures
How to Find All References to an Object in a SQL Server Database
How to Get Table Definition in SQL Server

March 13, 2024 Filed Under: How To Tagged With: Microsoft SQL Server, SQL Server

How to Find a String in SQL Server Stored Procedures

This is just quick tip found from this link and is actually good to use as a starting point:

USE DATABASE;
GO

SELECT [Schema] = schema_name(o.schema_id), o.Name, o.type
FROM sys.sql_modules m
INNER JOIN sys.objects o
ON o.object_id = m.object_id
WHERE m.definition LIKE '%YOUR-STRING%'
GO

Further Reading

How to Find All References to an Object in a SQL Server Database
How to Search for a String in All Tables in a Database
How to find a specific text string in a SQL Server Stored Procedure, Function, View or Trigger
How to Find a Column Name in SQL Server Database
How to Get Names of All Tables in SQL Server

February 1, 2024 Filed Under: How To Tagged With: Microsoft SQL Server, SQL, SQL Server

How to Remove Cached Credentials without Rebooting Windows

The typical situation is you’ve connected to a network share with a User ID and a password. Then for one reason or another, the password was changed.

As soon as you get asked to enter the User ID and password again, even after entering the latest password, you’re still getting an error message:

Open Folder

\\server_name\c$ is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

The issue is after the password was recycled, the old password is still cached in your system, so we need to clear out the cache first.

You can check on what’s in the cache by opening a PowerShell or Command Prompt and type in the following:

C:\>net use

And you should see something similar to this:

C:\>net use
New connections will be remembered.


Status  Local    Remote                    Network
----------------------------------------------------------------------
OK      G:       \\Server1\Apps            Microsoft Windows Network
OK      H:       \\Server2\Customers       Microsoft Windows Network

Disconnected     \\server_name\c$          Microsoft Windows Network
The command completed successfully.

The network drive you’re looking for is the one that is disconnected and we need to delete it.

We can do so by typing the following command:

net use \\server_name\c$ /delete

And you will get confirmation that it was deleted successfully.

C:\>net use \\server_name\c$ /delete
\\server_name\c$ was deleted successfully.

Once you see this, you can close the PowerShell or Command Prompt windows and try to reconnect to the network share drive again.

Further Reading

How do I remove login credentials for a network location in Win7?
How to delete cached temporarily credentials for a network share on a Windows machine without rebooting or logging off

July 27, 2023 Filed Under: How To Tagged With: PowerShell, Windows

How to Search for a String in All Tables in a Database

If you want to look where a string is in all tables in a database, how do you do that?

Here’s a very helpful SQL to run:

DECLARE @SearchStr nvarchar(100)
SET @SearchStr = '## YOUR STRING HERE ##'

-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
-- Purpose: To search all columns of all tables for a given search string
-- Written by: Narayana Vyas Kondreddi
-- Site: http://vyaskn.tripod.com
-- Updated and tested by Tim Gaunt
-- http://www.thesitedoctor.co.uk
-- http://blogs.thesitedoctor.co.uk/tim/2010/02/19/Search+Every+Table+And+Field+In+A+SQL+Server+Database+Updated.aspx
-- Tested on: SQL Server 7.0, SQL Server 2000, SQL Server 2005 and SQL Server 2010
-- Date modified: 03rd March 2011 19:00 GMT
CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))
 
SET NOCOUNT ON

DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET  @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
 
WHILE @TableName IS NOT NULL

BEGIN
  SET @ColumnName = ''
  SET @TableName = 
  (
    SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)) 
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_TYPE = 'BASE TABLE'
    AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName AND OBJECTPROPERTY(
      OBJECT_ID(
        QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
      ), 'IsMSShipped'
    ) = 0
  )

  WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
         
  BEGIN
    SET @ColumnName =
    (
      SELECT MIN(QUOTENAME(COLUMN_NAME))
      FRO M INFORMATION_SCHEMA.COLUMNS
      WHERE TABLE_SCHEMA = PARSENAME(@TableName, 2)
        AND TABLE_NAME = PARSENAME(@TableName, 1)
        AND DATA_TYPE IN ('char', 'varchar', 'nchar'
          , 'nvarchar', 'int', 'decimal')
        AND QUOTENAME(COLUMN_NAME) > @ColumnName
    )
 
    IF @ColumnName IS NOT NULL
         
    BEGIN
      INSERT INTO #Results
      EXEC
      (
        'SELECT ''' + @TableName + '.' + @ColumnName + ''', 
        LEFT(' + @ColumnName + ', 3630) 
        FROM ' + @TableName + ' (NOLOCK) ' +
        ' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
      )
    END
  END   
END
 
SELECT ColumnName, ColumnValue FROM #Results
 
DROP TABLE #Results

Further Reading

How to Get Names of All Tables in SQL Server
How to Find a Column Name in SQL Server Database
Search all tables, all columns for a specific value SQL Server
How to Find a String in SQL Server Stored Procedures

April 3, 2023 Filed Under: How To Tagged With: Microsoft SQL Server, SQL, SQL Server

How to Install Cryptomator on macOS

Cryptomator is a free and open-source client-side encryption tool that can be used to encrypt files before uploading them to cloud storage services.

Here are the steps to install Cryptomator:

  1. Go to the Cryptomator website.

  2. Before you install the Cryptomator program, you can install macFUSE.

    Please note that Cryptomator recommended macFuse for Intel and FUSE-T for Apple Silicon but I found that FUSE-T is still buggy. It is still tagged as experimental, so use it at your own risk. It gave me a panic attack when I saw less than half of my folders showed up after upgrading to a newer version of FUSE-T. Only after I switched back to macFUSE could I see the complete folders again.

  3. Open the downloaded file and follow the installation wizard.

    Cryptomator Mac installation

  4. Once the installation is complete, launch Cryptomator.

  5. Create a new vault by clicking on Create New Vault and selecting the location where you want to create it.

  6. Set a password for the vault and click Create Vault.

  7. Your new vault will now be visible in the Cryptomator interface. You can drag and drop files into it to encrypt them.

That’s it! You have successfully installed and set up Cryptomator.

If you find the software useful, you can help supporting it by purchasing a Supporter Certificate or Donation.

Cryptomator - Support Fund

Download

Cryptomator: Download
macFUSE

Further Reading

FUSE-T

March 3, 2023 Filed Under: How To Tagged With: Information Security, macOS

Next Page »
Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure