| सर्वर दुनिया | गोपनीयता नीति | सहायता / संपर्क करें |
1887 / 126180401
|
SQL Server 2022 : bcp उपयोगिता2023/12/07 |
|
bcp (bulk copy program) उपयोगिता के साथ किसी निर्दिष्ट प्रारूप में किसी इंस्टेंस और फ़ाइल के बीच डेटा आयात या निर्यात करना संभव है।
|
|
| [1] | [bcp] कमांड का उपयोग करने के लिए जो [mssql-tools] पैकेज में शामिल है, डेटा की प्रतिलिपि बनाना संभव है। |
|
root@dlp:~# sqlcmd -S localhost -U SA -Q 'select name,create_date from sys.databases' Password: name create_date ------------------------- ----------------------- master 2003-04-08 09:13:36.390 tempdb 2023-11-24 09:28:30.890 model 2003-04-08 09:13:36.390 msdb 2023-10-30 16:52:55.553 SampleDB 2023-11-24 09:51:11.083 SampleDB2 2023-11-24 10:02:21.497 (6 rows affected) # कैरेक्टर डेटा प्रकार के साथ [SampleDB] में [Sample_Table] से [test.txt] में डेटा निर्यात करें root@dlp:~# bcp SampleDB.dbo.Sample_Table out test.txt -c -t, -S localhost -U SA Password: Starting copy... 3 rows copied. Network packet size (bytes): 4096 Clock Time (ms.) Total : 1 Average : (3000.0 rows per sec.)
root@dlp:~#
cat test.txt 00001,Ubuntu,Linux,2023-11-24 00002,Debian,Linux,2023-11-24 00003,RedHat,Linux,2023-11-24 # अन्य विकल्पों के लिए root@dlp:~# bcp -h
usage: bcp {dbtable | query} {in | out | queryout | format} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n native type] [-c character type] [-w wide character type]
[-N keep non-text native] [-q quoted identifier]
[-t field terminator] [-r row terminator]
[-a packetsize] [-K application intent]
[-S server name or DSN if -D provided] [-D treat -S as DSN]
[-U username] [-P password or tokenfile]
[-T trusted connection] [-v version] [-R regional enable]
[-k keep null values] [-E keep identity values][-G Azure Active Directory Authentication]
[-h "load hints"] [-d database name]
|
| Sponsored Link |
|
|