I have some tables in a DB as mentioned below.,
**Table1**
+-------+--------------+-------------+
|**ID** |**Name** |**Country** |
+-------+--------------+-------------+
| 1 |Avinash Kumar |India |
| 2 |Sat!sh@S |USA |
| 3 |$32kjs |UK |
| 4 |#$@@@ |AFRICA |
| 5 |Krishnas_has |USA |
+-------+--------------+-------------+
**Table2**
+-------+--------------+-------------+-----------+
|**ID** |**Name1** |**Country1** |**Region1**|
+-------+--------------+-------------+-----------+
| 1 |Avinash Kumar |India |EMEA |
| 2 |Sat!sh@S |USA |ASIA@@ |
| 3 |$32kjs |UK |EU._A |
| 4 |#$@@@ |AFRICA |HAS&# |
| 5 |Krishnas_has |USA |KALc!! |
+-------+--------------+-------------+-----------+
**Table3**
+-------+--------------+-------------+-----------+-----------+
|**ID** |**Name2** |**Country2** |**Region2**|**State2** |
+-------+--------------+-------------+-----------+-----------+
| 1 |Avinash.Kumar |India$ |EMEA |BANG_& |
| 2 |Sat!sh@S |US!!A |ASIA@@ |SO$TH |
| 3 |$32kjs |U@K |EU._A |TRUTH |
| 4 |#$@@@ |AFRICA |HAS |HAPPY |
| 5 |Krishnas_has |USA# |KALc!! |!ASDF# |
+-------+--------------+-------------+-----------+-----------+
And one more thing is like I want to pass the table name as variable. Something like this
Declare @Table
Select * from @Table
What ever I pass in @Table the code has to work dynamically
Now how can I find the special character columns if i pass @Table = Table3
For example: My output should be like this when I want to find special characters in Table3
**EXPECTED OUTPUT**
+-------+--------------+-------------+-----------+-----------+
|**ID** |**Name2** |**Country2** |**Region2**|**State2** |
+-------+--------------+-------------+-----------+-----------+
| 1 |Avinash.Kumar |India$ | |BANG_& |
| 2 |Sat!sh@S |US!!A |ASIA@@ |SO$TH |
| 3 |$32kjs |U@K |EU._A | |
| 4 |#$@@@ | | | |
| 5 |Krishnas_has |USA# |KALc!! |!ASDF# |
+-------+--------------+-------------+-----------+-----------+
Can someone please help me with this?
Thanks in advance!