Metadata DB_NAME SQL function


1. Usage of DB_NAME

SQL Server Query 1

            
 SELECT DB_NAME() AS Current_Database  
union
SELECT DB_NAME(3) AS Current_Database

Create SQL query with SqlQueryBuilder 1

            
 var (sql1, parameters1) = new SqlQueryBuilder()  
.Select()
.Column(new DB_NAME(), "Current_Database")
.Union(new SqlQueryBuilder()
.Select()
.Column(new DB_NAME(3), "Current_database")
)
.Build();

Query build by SqlQueryBuilder 1

            
SELECT DB_NAME() AS Current_Database
UNION
SELECT DB_NAME(@pMAIN_2509031317004558340) AS Current_database;


            
        

Parameters (If used)

Name Value
@pMAIN_2509031317004558340 3

Query Results 1:

  Current_Database
1 model
2 TheBlueSoftDB


1. Usage of DB_NAME with sys table

SQL Server Query 2

            
 SELECT DB_NAME(database_id) AS [Database],  
Database_ID
FROM sys.databases;

Create SQL query with SqlQueryBuilder 2

            
 var (sql2, parameters2) = new SqlQueryBuilder()  
.Select()
.Column(new DB_NAME(new Column("database_id")), "[Database]")
.Column("Database_ID", "Database_ID")
.From("sys.databases")
.Build();

Query build by SqlQueryBuilder 2

            
SELECT DB_NAME(database_id) AS [Database],
       Database_ID AS Database_ID
FROM sys.databases;


            
        

Parameters (If used)

Name Value

Query Results 2:

  Database Database_ID
1 master 1
2 model 3
3 barodian_demo3 665
4 mmms 280
5 Zuuk_Identity 204
6 barodian_kaphipibama07 403
7 web_kaushiki 450
8 maqsol_ravi 268
9 onveytec_ClinicManagementSystem 248
10 db_education_liscs 35
11 barodian_ShoeCenter 68
12 barodian_watervadodara 599
13 bm_interestbook 315
14 web_kmps 451
15 db_test_winquoter 87
16 testdb1 706
17 erpprosi_dbdp2 8
18 erpprosi_dbbabloo 32
19 db_a44731_dbakg 46
20 erpprosi_dbpmi 95
21 skyzserv_BSERP 125
22 exertica_MLP 415
23 CoLiving 398
24 barodian_moderneye 663
25 workprep 276
26 exertica_waterboard 367
27 swastik_bd 216
28 GST_Kapil 584
29 barodian_Interestbookmufid 94
30 db_education_risrajasthan 742
31 barodian_venus 36
32 barodian_vadodarawater 562
33 barodian_prajitkotia 649
34 AdminPaneldb 319
35 45identityQA 54
36 barodian_demo6 670
37 Jainshubh_Data 258
38 aqrated787 231
39 aqrated786 241
40 yousoc 199
41 igc_db 202
42 SolarMining 188
43 bookingaccess 402
44 hkkpDb 780
45 ASDB 413
46 barodian_prachipatel 656
47 CB 384
48 CBUAT 703
49 skyzserv_bestyatra 228
50 barodian_demo2 664
51 cyphbloc_dbdoc 411
52 apnataxi_ATP 765
53 barodian_nehaspaloon 605
54 eduwises_demorvDB 9
55 eduwise_AlHeraDB 23
56 erp_IQRADB 28
57 eduwises_alnoorinV3DB 30
58 eduwises_KuloomV3DB 47
59 eduwises_imdadDB 92
60 erp_sunshineDB 103
61 erp_JsisDB 109
62 erp_alphabetDB 119
63 eduwises_SIMNEWDB 138
64 erp_VGSdb 493
65 erp_KHSDB 504
66 TimesMasterDB 215
67 barodian_mansiparikh 657
68 meata_dev 278
69 arulmihu 171
70 hst_v1 219
71 sujindb 102
72 demo 118
73 fitonbeatDB 310
74 barodian_owt 91
75 iOrderOnline 78
76 Megaskil_megasdb 16
77 UPDELED18 177
78 skvdb 148
79 AryastaysDB 135
80 barodian_surveydemo 687
81 SWTBOA 481
82 skyzserv_db_SkyzManagement 383
83 barodian_ShreemGarbhSanskar 680
84 web_sgps 457
85 TallyConnector4.0 262
86 web_pssktr 373
87 db_a797c8_erpcin 376
88 StockDataAnalysis 67
89 domusartdb_2022 444
90 devwi 182
91 wiprod 320
92 smakat_v1 151
93 barodian_anmolcreation 641
94 magizh_v1 112
95 SuitsmithnewDB 431
96 BTCRESULT13 705
97 eduwisee_antqDB 64
98 barodian_jk9consultancy 651
99 cishtsalesandservice 22
100 tyagi 496
101 web_diptifinancial 107
102 pets_mgmt_dev 174
103 erpusers 74
104 FycDb 150
105 Cubixv2 220
106 apress 583
107 db_steemainv_mahendragasagencyktr 66
108 jantechi_contactdemo 263
109 db_puriyai 719
110 db_steemainv_magency 471
111 redmonta_v1 739
112 web_bishnuflourmill 446
113 WhatsAppAPI 587
114 barodian_ebio_app 265
115 talkuscs_ 418
116 Tyagi_B 561
117 Lumina_B 572
118 GST_ECO 699
119 KC_Online23 140
120 als 181
121 XnD1 217
122 XnD2 555
123 jainswor_data 362
124 ics_trans 350
125 db_steemainv_newkoshihospital 473
126 db_ddr 129
127 aasinfoAPIs 233
128 leaptech_DbBJP4DnhDmDv 632
129 easysoft_data 292
130 ZahratyCoreDB 116
131 ZahratyCore 625
132 skyzserv_worldbestdmc 180
133 db_education_cpsmadhubani 460
134 db_test_digitalmalkhana 133
135 barodian_metaadsworld 693
136 eduwises_mamoonEDB 99
137 web_jpsktr 449
138 gurukripa 491
139 barodian_theonewebtechnology 643
140 barodian_demo8 673
141 barodian_baroda 236
142 canla_backup 56
143 VECDB 352
144 ywtr 245
145 db_education_nmpsbihariganj 464
146 barodian_bookpoint 646
147 skyzserv_bestdubaidmc 251
148 barodian_splendidinstitute 542
149 barodian_owttest 344
150 hul 281
151 BendPlusCore 55
152 BendPlusMob 63
153 BendPlusWeb 633
154 TLK_DB_Travel 211
155 TLIFE_DB_Travel 212
156 FLYCITY_DB 622
157 TheBlueSoftDB 43
158 Technical 81
159 DBAddhrit 210
160 DPED 714
161 barodian_electricsoftware 120
162 barodian_demo4 666
163 GST_Aman 108
164 barodian_dkpest 143
165 onlinedotnettutor 369
166 skyzserv_digitallab 267
167 db_education_ppsktr 126
168 Xn_10_1770 374
169 eduwises_ChengailDB 290
170 futurecl_hrmsdemo 255
171 barodian_sewabsnlguj 692
172 testdatabasefms 495
173 myLocBook 40
174 db_ajcc 566
175 db_ajd 567
176 db_ajoo 568
177 CubixBaseMaster 738
178 HTBOA 10
179 suratevaluateprod 44
180 evaluatenew 172
181 db_education 438
182 TPIContextNewDB 149
183 bookmyground_dev 13
184 skyzserv_crm 38
185 aveerimm_ 589
186 DBConstructionERP 213
187 barodian_recruiterhelper 538
188 db_education_sjsdumar 507
189 xavierbti 192
190 barodian_demo 378
191 skyzserv_db_ImagenaryStock 169
192 barodian_aatmiyadudhdairymvc 410
193 barodian_aatmiyadudhdairybuckup 724
194 barodian_aviralsamachar 334
195 UPBTC15 179
196 Dribb 131
197 infin 274
198 infin_dev 275
199 FileTrackingDB 214
200 barodian_Pathey_Career_Academy 690
201 MaxNxt_MNSD 501
202 UPBTC 729
203 dialgm_db 379
204 db_buykul 458
205 barodian_shrutipatel 669
206 web_ppsktr 454
207 PlayschoolDB 291
208 dialgm_test 287
209 tempdb 2
210 AQRATED101 242
211 barodian_OWTMain 41
212 shoepark 286
213 db_steemainv 474
214 MERATIME 725
215 db_education_npesktr 465
216 dealeasydb 300
217 mcts_db 145
218 hisDb 271
219 edukotco_artkot 147
220 canla_prod 39
221 StanExpection 152
222 UPBTC13 443
223 skyzserv_BS_V1 34
224 sncDemo 186
225 bsam 88
226 db_sspl 73
227 db_test2 71
228 vtielmadras 227
229 ikeyAinalwadi 11
230 ikeyBillSeries 137
231 ikeySundial2022 294
232 ikeyMobileDemoDB 616
233 db_steemainv_accounts 33
234 Alljains_data 482
235 hotelier 401
236 hotelContent 620
237 TravelAlong_DB 207
238 Namaste-Indian 166
239 jb2_main 141
240 DotNetNuke_1 701
241 barodian_onewebtechnology 655
242 sibsolnsDB 17
243 AjitCRM 25
244 barodian_ndgujaratcore 229
245 db_education_wpsmanihari 469
246 db_education_rsisaurangabad 476
247 db_education_vngroup 477
248 fgpartnersList 223
249 aryastays 134
250 barodian_demo5 667
251 db_steemainv_mahendragasagency 470
252 45FFD_S 5
253 LiveTextBooksDB 331
254 WhatsAppAPIBackUp 628
255 db_education_mpsbarsoi 463
256 db_education_gdsazamnagar 627
257 db_education_kaushiki 462
258 erp_ReamDB 61
259 db_education_npisktr 466
260 devnagrihindims 195
261 fissmilk 110
262 db_education_npisplustwo 386
263 barodian_truecolordemo 685
264 PROF_Serv_DB 508
265 barodian_snehalbeyoutie 671
266 db_education_spslkr 115
267 SanganiFinancial 57
268 rademo 284
269 tenant 576
270 tenantUAT 590
271 eduwises_AliahtestDB 51
272 web_chhktr 448
273 web_vidyaniketan 69
274 barodian_AES 31
275 krishi360 252
276 farms360 253
277 bullpressoil 254
278 allurjgm_ALProducts 6
279 allurejgm_ALProduct 21
280 Zuuk_Product 200
281 BrainchildDB 261
282 MLMAnnaitherasa 53
283 db_education_dpsforbesganj 332
284 db_education_sspsdaudnagar 42
285 db_invoice 565
286 db_emadtamirat 209
287 web_mspvtltd 586
288 db_education_ourownschool 467
289 GruhalaxmiMF 139
290 web_logicalvastu 452
291 db_test_hms 19
292 eduwises_alnoorinDB 510
293 mif 619
294 mif22 90
295 mif24 105
296 mif23 206
297 db_education_chhktr 459
298 db_bhawaniwelfare 447
299 Solar 76
300 barodian_owteducation 682
301 barodian_matrimonial 540
302 agsdb 89
303 aqrated100 240
304 Sikkim.Nursing.Council 45
305 ocpp 184
306 jb2_backup 142
307 gscjbp_data 86
308 barodian_NovusApp 770
309 barodian_nehasperfect 237
310 barodian_managementsystem 644
311 DotNetNuke_2 26
312 jognur 700
313 MPSOS 48
314 futurecl_futurecloudapp 257
315 huldev 283
316 barodian_BarodianMarket_Core 264
317 dealeasydemodb 79
318 kamboj 193
319 Zuuk_Partner 203
320 NTT 727
321 barodian_jk9 653
322 dialgm_dev 288
323 canla_qa 272
324 iRamadan 96
325 GraciasResort_Test 485
326 ykscommunity 571
327 db_education_pssktr 93
328 db_education_test 232
329 barodian_varunsevatrust 238
330 svc_noida 717
331 dipscbse_DB 479
332 barodian_rhz 660
333 barodian_rahulpatel 676
334 barodian_ndgujarat 696
335 madhu 7
336 sstrading 84
337 sstr 124
338 msdb 4
339 45FFQA 49
340 Jazzbaat24DB 146
341 db_steemainv_mljewellers 293
342 skyzserv_erp 266
343 BookingAccessV2 621
344 barodian_owtcourse 654
345 exertica_LM_User 421
346 barodian_jivraksaksjap 539
347 ags_03052025 123
348 45identity_s 24
349 barodian_electronic 662
350 hotel 475
351 theno1 377
352 admin_tsp 785
353 Alite 15
354 Spanking_Data 298
355 barodian_bhimkrantisena 404
356 zuzodemo 580
357 dptextiles_v2 104
358 dptextiles_v3 235
359 workpro_uat 357
360 POS_DB 82
361 UPDELED21 695
362 barodian_mastersaloon 661
363 cyph_inotebook 581
364 CustomerBookingPortal 704
365 barodian_database 595
366 eduwises_NEWAAMSA 60
367 erp_KPSdb 111
368 erp_BBMDB 178
369 erp_gurukulDB 201
370 erp_AlbaikDB 505
371 erp_DSSDB 506
372 worpor 358
373 barodian_avnisheth 659
374 DotNetNuke_8 618
375 MeatTransport 279
376 recccsco_data 136
377 NabaQ 420
378 cottertech_v2 289
379 barodian_survey 686
380 barodian_ShivTransportDb 677
381 web_npisktr 453
382 EliteDriver_v1 62
383 shopnandhi_v1 72
384 CubixDemoErp 564
385 infin_dev_02052025 121
386 db_test_ecommerce 20
387 barodian_manishgandhi 650
388 barodian_iira 668
389 myOrders 97
390 web_rapidexcoaching 455
391 db_education_spvbhagalpur 12
392 barodian_happinessdeal 678
393 AowlVerb_DataBase 433
394 barodian_demo9 674
395 exertica_LM_Product 417
396 pickmyparcels 65
397 HotelierWeb 132
398 jkciorg1db 480
399 LocalTutorLive_DB_1 348
400 ice 75
401 ASHAZ 244
402 Appadmin 170
403 meata 277
404 canla 273
405 shopsuitsmithin_db 424
406 db_ebioserver_essl 130
407 erp 114
408 milmakaleptta 336
409 erpdemo 429
410 huldemo 282
411 barodian_vaishalimohite 642
412 ikeyDealer 388
413 barodian_education_Portal_Bita 689
414 exertica_LM_Invoice 422
415 faizdb 318
416 ConfigDB 14
417 barodian_BarodianMarket 679
418 db_education_jpsktr 461
419 barodian_owtdemo 270
420 barodian_demo10 675
421 brahmans_2 249
422 TEHRANTRAVELS_DB 368
423 web_sdlawcollege 456
424 skyzserv_nthindia 297
425 skyzserv_nthjapan 98
426 CremzoCRM 77
427 barodian_smartplayschool 647
428 cishtcom 775
429 barodian_market 639
430 barodian_demo1 658
431 ORScheduler 197
432 mahindra 194
433 barodian_OWTData 681
434 RTL2019 243
435 talktime_ 360
436 onveytec_LearningManagementSystem 173
437 barodian_truecolor 694
438 barodian_onlinetest 652
439 Parichay_data 247
440 OPERALOGI 218
441 barodian_manishghandhi 645
442 clinicmanagementdev 208
443 web_legaltech 296
444 skyzserv_dbCardApp 609
445 edukotco_edukot 773
446 db_smartoffice_biomax 85
447 laaromaexim 27
448 skyzserv_royalpharmacy 168
449 barodian_surveydemo1 688
450 tmsdemo 309
451 db_test 312
452 smartdev_store 423
453 barodian_BM_BarodianMarket 684
454 Zuuk_Customer 190
455 CraxusStore_VFH 29
456 db_steemainv_mightevehicle 472
457 barodian_demo7 672
458 DB_Stepping_Stones 405
459 AJevent_data 100
460 starinfotech 191
461 skyzserv_db_skyzorder 165
462 Gujju 167
463 GraciasResort 187
464 invo_furnitureDB 18
465 GWarriorsDB 176
466 skdemo 285
467 web_birdsbitumix 445
468 barodian_kaphipibamademo 269
469 STARSPORTS 37