Dbatools: [Bug] Copy-DbaDbTableData - DestinationTable error when source object name has leading numeric

Created on 7 Nov 2019  路  4Comments  路  Source: sqlcollaborative/dbatools

Environmental information

PowerShell version:

Name                           Value                                                                                                                                                          
----                           -----                                                                                                                                                          
PSVersion                      5.1.18362.145                                                                                                                                                  
PSEdition                      Desktop                                                                                                                                                        
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                        
BuildVersion                   10.0.18362.145                                                                                                                                                 
CLRVersion                     4.0.30319.42000                                                                                                                                                
WSManStackVersion              3.0                                                                                                                                                            
PSRemotingProtocolVersion      2.3                                                                                                                                                            
SerializationVersion           1.1.0.1                                                                                                                                                        

dbatools Module version:

Name    : dbatools
Path    : C:\Program Files\WindowsPowerShell\Modules\dbatools\1.0.67\dbatools.psd1
Version : 1.0.67

Name    : dbatools
Path    : C:\Program Files\WindowsPowerShell\Modules\dbatools\0.9.834\dbatools.psd1
Version : 0.9.834

Name    : dbatools
Path    : C:\Program Files\WindowsPowerShell\Modules\dbatools\0.9.419\dbatools.psd1
Version : 0.9.419

Name    : dbatools
Path    : C:\Program Files\WindowsPowerShell\Modules\dbatools\0.9.373\dbatools.psd1
Version : 0.9.373                                

SQL Server:

Microsoft SQL Server 2016 (SP2-CU8) (KB4505830) - 13.0.5426.0 (X64)   Jul 21 2019 21:16:47   
Copyright (c) Microsoft Corporation  Developer Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 18362: ) (Hypervisor) 

Report

When using Copy-DbaDbTableData and the source table has a leading numeric as the table name eg 4Badges, the the following line:

Copy-DbaDbTableData -SqlInstance mySQL2016 -Destination mySQL2016-Database StackOverflow2013 -DestinationDatabase DBATools -Table 4Badges -AutoCreateTable

Will error with:

**WARNING: [12:14:39][Copy-DbaDbTableData] Unable to determine destination table: [dbo].[4Badges] | Incorrect syntax near '$14'.**

If I alter the table name to remove the leading numeric, or add letter before it, the code runs without issue.

Host used

  • [ ] powershell.exe
  • [X] ISE
  • [ ] VS Code
  • [ ] Other (please specify)

If anything other than powershell.exe was used, please confirm that you can duplicate the issue with powershell.exe

  • [ ] Still buggy in powershell.exe

Errors Received


no output from that line.

Steps to Reproduce

Copy-DbaDbTableData -SqlInstance mySQL2016 -Destination mySQL2016-Database StackOverflow2013 -DestinationDatabase DBATools -Table 4Badges -AutoCreateTable

Expected Behavior

Actual Behavior

WARNING: [12:14:39][Copy-DbaDbTableData] Unable to determine destination table: [dbo].[4Badges] | Incorrect syntax near '$14'.

bugs_life

All 4 comments

This issue has been automatically marked as stale because it has not had recent activity. If you would like this issue to remain open:

  • Verify that you can still reproduce the issue in the latest version of dbatools
  • Comment that the issue is still reproducible and include:

    • What version of dbatools you reproduced the issue on

    • What OS and version you reproduced the issue on

    • What steps you followed to reproduce the issue

I am unable to reproduce this in the current version.
image

yesss thank you so much @jaxnoth !

If you could not replicate it on latest version then all good. I think I was on 0.9 something.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cporteou picture cporteou  路  7Comments

bigbearzhu picture bigbearzhu  路  4Comments

joshcorr picture joshcorr  路  9Comments

pmsousa picture pmsousa  路  8Comments

llmuculusll picture llmuculusll  路  4Comments