Why SQLCMD is a pain?

I am kinda curious, does anyone use mssql-server? if use, can you tell me are you use SQLCMD or not, if not what tools you using for query mssql-server? I know azura studio, but my potato laptop can’t handle that, does anyone have alternative beside SQLCMD and Azure Studio? I know there are mssql-cli, but I can’t found that package in AUR and in the mssql-cli github only provide for ubuntu, rhel, debian and CentOS

Isn’t that a Windows tool?

I think the mssql-tools package exists in the AUR for mssql-server. Perhaps you’ll find something you need in that.

pamac build mssql-tools

There’s also the deprecation notice that’s somewhat detracting.

DBbeaver or any of the following might potentially be useful:

Otherwise :person_shrugging:

Cheers.

If you can use visual studio code - it should be possible to use azure datastudio as well - they are built upon the same platform.

I use mssql - and even run a couple of local instances, one on a manjaro box the other on Microsoft Server. If I need to interact with the service I have most used SQL Management Studio. But since my main platform is Manjaro - Azure Datastudio works - not as featurerich as SQL Management Studio but for simple tasks - like bulk changes to a recordset - it works great.

We rarely interact with the service using CLI directly but should it be necessary I would use powershell.

For interacting with the production database we have scripted the interaction using powershell.

we use a powershell script to keep a sandbox environment current

  • creates a backup
  • copy that backup to a sandbox instance
  • change ownership on the backup file
  • creates a tail backup
  • restoring the backup into the sandbox instance

When the database schema needs update we use EntifyFramework to do the lifting based on a codefirst approach.

Powershell can be build from a custom AUR script … and has an excellent forum - which also discuss interaction with sql server Search results for 'sql' - PowerShell Forums

SQLCMD is official tool in any platform, you can use sqlcmd in linux too, but sqlcmd is very uncomfortable, so I want change to other CLI, the reason I don’t use GUI just my laptop can’t handle the workload
Thank you for reply, I am really appreciate that

1 Like

It is not that hard to use sqlcmd - it require you to know the database schema by heart - or at least have a reference sheet at hand.

Short example from my local development service

sqlcmd -S <sqlname> -H <hostname> -C -U <username>
Password:
1> use crmdata
2> go
Changed database context to 'CRMDATA'.
1> select top(5) [SalesItemId], [sku], [Description] from salesitems
2> go
SalesItemId                                                                                                                      sku                  Description                                                                                         
-------------------------------------------------------------------------------------------------------------------------------- -------------------- ----------------------------------------------------------------------------------------------------
0033a2af-cb63-ec11-9f08-000d3ab4fc9a                                                                                             G360                 11800 FARVE G360                                                                                    
00373921-2e63-ec11-9f08-000d3ab4fc9a                                                                                             04,1900              STOR SMART CLEANERS                                                                                 
00383921-2e63-ec11-9f08-000d3ab4fc9a                                                                                             05,2311              Moulding Tape 15 mm x 10 m                                                                          
0049449a-d663-ec11-9f08-000d3ab4fc9a                                                                                             02,1200              Solid Spray Filler                                                                                  
007f3127-2e63-ec11-9f08-000d3ab4fc9a                                                                                             90,0206              Micro Torch   use

Another example getting all columns in a named table

1> select COLUMN_NAME from information_schema.columns where table_name = 'SalesItems'
2> go
COLUMN_NAME                                                                                                                     
--------------------------------------------------------------------------------------------------------------------------------
SalesItemId                                                                                                                     
ProductVariantId                                                                                                                
Sku                                                                                                                             
Description                                                                                                                     
Description2                                                                                                                    
ProductGroup                                                                                                                    
PictureLink                                                                                                                     
ShortName                                                                                                                       
CreateTimestamp                                                                                                                 
UpdateTimestamp                                                                                                                 
ArchiveTimestamp                                                                                                                
SyncTimestamp                                                                                                                   
Description1                                                                                                                    
VendorItemNo                                                                                                                    
SalesRepCountryCode                                                                                                             
Location                                                                                                                        
BoxSize                                                                                                                         
OnDemand

If you are more comfortable with a GUI - dbeaver community edition is working very well.

Just be sure to use the latest jdk-openjdk

sudo pacman -Syu dbeaver jdk-openjdk