> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# VBA to T-SQL via TDD: Step 4
- URL: https://nolongerset.com/vba-to-tsql-via-tdd-step-4/
- Published: 2021-09-11T02:10:05.000Z
- Updated: 2026-05-08T13:02:30.000Z
- Description: Step 4. Use the results of your Access query to populate the test table
- Author: Mike Wolfe
- Tags: VBA to T-SQL via TDD, #Import 2026-05-20 02:59

*This is Part 4 of [my series](https://nolongerset.com/vba-to-tsql-via-tdd/) on converting a VBA function to a SQL Server scalar function using test driven development. As a proof of concept, I will be [re-implementing the VBA Round function](https://nolongerset.com/trust-but-verify/) (which uses bankers rounding) as a SQL Server scalar function.*

---

After building a "test table population query" in [Step 2](https://nolongerset.com/vba-to-tsql-via-tdd-step-2/) and creating the test table structure itself in [Step 3](https://nolongerset.com/vba-to-tsql-via-tdd-step-3/), **populating the SQL Server test table is a simple matter of copy and paste**.

1. Execute the test table population query
2. Press Ctrl + A to select all the rows in the query
3. Press Ctrl + C to copy the rows to the clipboard
4. Create a New Query window in your development database in [SSMS](https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15)
5. Press Ctrl + V to paste the rows from the clipboard (delete or comment out the header row)
6. Press F5 to execute the T-SQL statements

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/09/image-35.png)

Step 1\. The test table population query

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/09/image-36.png)

Step 2 & 3\. Select all (\[Ctrl\] + \[A\]) then copy (\[Ctrl\] + \[C\])

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/09/image-37.png)

Step 4\. Create a New Query

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/09/image-38.png)

Step 5\. Paste (\[Ctrl\] + \[V\])

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/09/image-39.png)

Step 6\. Execute the INSERT INTO statements (\[F5\])

### Referenced articles

[How to Convert a VBA Function to a SQL Server Scalar FunctionMS Access Developers Can Remove All the Risk From This Complex Process With These 3 Words![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/09/caterpillars-2869783_1920.jpg)](https://nolongerset.com/vba-to-tsql-via-tdd/)

[Trust But VerifyWhat Ronald Reagan’s Words Can Teach Us About the Sample Code We Find on the Internet![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/09/president-67550_1920.jpg)](https://nolongerset.com/trust-but-verify/)

[VBA to T-SQL via TDD: Step 2Step 2\. Build a “test table population query” in Microsoft Access![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/09/Step2-1.png)](https://nolongerset.com/vba-to-tsql-via-tdd-step-2/)

[VBA to T-SQL via TDD: Step 3Step 3\. Create a temporary test table in SQL Server![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/09/Step3-1.png)](https://nolongerset.com/vba-to-tsql-via-tdd-step-3/)

### External references

[Download SQL Server Management Studio (SSMS) - SQL Server Management Studio (SSMS)Download the latest version of SQL Server Management Studio (SSMS).Microsoft Docsdzsquared![](https://docs.microsoft.com/en-us/media/logos/logo-ms-social.png)](https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15)