Skip to main content

How to Backup using SQL Server Data

 Sometimes Task->Generate Scripts takes too time to backup especially when you want to backup only selected tables in the database. This can be done easily with bcp, issuing the command in your power shell dumps the data in tab-delimited values into a file.

\> bcp "DATABASE.dbo.TABLE" out "C:\Downloads\TABLE.sql" -c -S "HOSTNAME" -U USERNAME -P PASSWORD

Hope this helps, this is very useful for migrating data and for seeders where some tables are only needed to be seeded into the database as dependent values for other tables. We are heavily using this technique for testing. As for reference, here's our use case

  • Dump data into .sql files
  • Seed using QueryFromFile
  • Run automation; this can insert new values to other tables based from the seed data from .sql file
  • Rollback new values
We need to rollback each time since we want to have data the same as it was so we can run each time and expect the same results for our testing. If not, there should be error somewhere or a bug introduced in the new code that we need to fix.

That's it for now. See you in the next blog. Take care everyone!

Comments

Popular posts from this blog

Add Brave Browser to Netbeans

We'll I'm liking Brave now, great isn't it. With the token and all and privacy and stuff. And all the good stuff, right? So what other good thing we can do about it other than adding it to our favorite editor. So here it is, adding it is through Tools->Options->General Edit Web Browser Manager and add this setting below. Find the brave.exe usually it can be found in C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe and voila we're good. See you next posts everyone!

Monero is your friendly neighbor - no not really, I mean friendly CPU miner

Monero is another one of those crypto currency that was really big news in 2017. Now the year ends and hoping for a fresh start in 2018. Just got my masternode up and so far so good. X11 is the algo chosen by Sucre so it's not really friendly to CPU. Now, back to Monero. Its algorithm is Cryptonite and it's friendly to miners that only has CPU. First off, get your monero wallet here . As for me, I do use FreeWallet so I don't worry other app/web for every wallet that I have. Anyway, if you get your monero wallet address, that's OK. All we have to do is to find pool to mine. I use MineXMR as it's simpler. You can choose whatever you like, just search for "monero mining pools" and you get bunch to choose from. Get the miner here, extract it to your location of choice and edit the config.json file. {     "algo": "cryptonight",  // cryptonight (default) or cryptonight-lite     "av": 0,                // algorithm var...

Theory of the Genesis of Bam-e

Well, I was pondering of things today. I mean no things? Like nothing? Can't mine like shit, electricity is down almost every 2 hours so I was wondering to myself... How the hell the name "Bam-e" came to be? As a programmer I need to know the origin of it. Like learning new techniques in programming. I need to dissect things. First off, maybe it's a Tagalog term. I think so. And yeah I found it, or did I. I thought the story goes like this. Someone named Dave came to visit Bam. Here it goes... Dave: Hi, Bam ano yang ginawa mo? Bam: Nagluluto Dave: Yay, maganda yan! Masarap ba yan? Bam: Ah wala, hinalo ko lang ang mga natirang ingredients Dave: Ano name nyan? Bam: Hindi ako sure eh! Dave: Patingin nga? Bam: Sure Dave: Pancit lang naman yan Bam eh! Well, if you don't know tagalog. I'm sorry, I'm not the person to talk to. I'm Bisaya and I'm very bad at tutoring Filipino. The hell, I got 79% when I was in high school. I hate the God ...