Posts

Error for system versioned tables while importing to SQL Server 2012

What does this error mean: Error SQL72014: .Net SqlClient Data Provider: Msg 102, Level 15, State 1, Line 10 Incorrect syntax near 'GENERATED'. CREATE TABLE [dbo].[TableName] (....... On your SQL Azure database from where the export is taken, the table for which the error is shown has system versioning turned on. Following is the code to turn off the system versioning on the table: In case if you want to drop the columns associated with versioning you may run following code to first drop the constraint on both the columns and then drop the columns: ALTER TABLE [dbo].[TableName] DROP CONSTRAINT [DF_SysEnd]; ALTER TABLE [dbo].[TableName] DROP CONSTRAINT [DF_SysStart]; ALTER TABLE [dbo].[TableName] DROP COLUMN [SysStartTime]; ALTER TABLE [dbo].[TableName] DROP COLUMN [SysEndTime]; Note: The constraint names and column names could be different in your case.

Get SQL Transaction during an interval

To know how many transactions are occuring on a Server instance following is the script: Make sure you run them multiple times as each time the result will be different based on the load running during the time you capture it.

Remove image_url related error appearing during structured data testing

Image
So your blog has structured data and now want to make sure that the web crawlers should also understand that you have placed structured data on your blog. The best way to make sure that is to test your blog URL using  https://search.google.com/structured-data/testing-tool . This is not a validator of the tags in your blog but a tool, using which Google makes sure it can read structured data from the page and if required can appear as a  rich card  in a search result. If you have a blog on Blogger and have validated it using the Google structured data testing tool, there are chances that you might have seen below error: The property postId is not recognised by Google for an object of type BlogPosting. Below are the steps to how to remove postId related error appearing during Structured data testing. Go to  Blogger.com Select the Blog in which you want to make the change. Click "Template" in the left menu. Click on "Edit HTML" Once the HTML editor appears...

Copy local file to Azure storage

Image
When working with Azure you may require copying a file to and fro between Azure storage. Now when the Azure Price are reduced , you too might want to move your files to Azure. Copying a file to Azure is easy. You will need to have Az Copy   installed. Once you have installed it you can use the command prompt to copy files to Azure. You must execute AzCopy executable file from the directory in which it is installed. Below is the code to copy "sample.txt" from the local machine to Azure Storage. The code required access key of the storage the file is copied to or from. I use the above code in a batch file so I have mentioned the code to move to the "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy" folder because by default the Az Copy tool is installed in that folder. The code also requires access key of the storage where the file is copied to or from. This access key can be found in Azure. Below screenshot shows you how to get the storage access key in Azure po...

Storing and retrieving data using HTML Local Storage

Here is the sample HTML file with javascript to store data in HTML local storage. You can run it here. Click the below button to add the lines for text1, text2 and text3 in local storage. Add This is text1. Sample text2. Text3 example. If you are using Google Chrome below are the steps to check if the data was stored. Click Menu > More Tools > Developer Tools (Ctrl + Shift + I) Click "Application" In the left pane under Storage navigate to Local Storage > http://SQLGear.blogspot.in In the right pane, you could find the data you just inserted against the key "List".

Get JSON data using Javascript

Below is the code of a simple HTML page used to fetch JSON data. I am using https://jsonplaceholder.typicode.com/ to fetch JSON data from. You can test it here.

Loop through all list items under an ordered or unordered list

Suppose you have the following HTML Code and you want to loop through each <li> tag under the top <ul> or <ol> tag: <ul id=" idOfTheListTag "> <li><ul> <li><input checked="1" type="checkbox" /></li> <li>A1</li> <li>B1</li> <li>C1</li> <li>D1</li> </ul> </li> <li><ul> <li><input checked="1" type="checkbox" /></li> <li>A2</li> <li>B2</li> <li>C2</li> <li>D2</li> </ul> </li> <li><ul id="menu"> <li><input checked="1" type="checkbox" /></li> <li>A3</li> <li>B3</li> <li>C3</li> <li>D3</li> </ul> </li> </ul> To loop through all the <li> tags below is the javascript function:

Make Money from Surveys