Getting miles from Geography Stored Procedure

I’m new to using the Geography datatype, but I’ve figured out how to use it to get a list of zipcodes from a point (in the stored procedure I just have the point as varchar and I provide it with the “Longitude Latitude”) so that was great. However, the next thing I need to be […]

“Estimated Number of Executions” is inflated

I have a situation where a slower query plan is being chosen instead of a faster one due to, I believe, some incorrect estimates. However, I can’t figure out where the incorrect estimates are coming from. Shown below is the faster plan which is not chosen because of the estimated cost of 123 for the […]

Delete table from EF CodeFirst migration

In EF Code first, I want to drop one column from one table & then delete another table. After removing one column from class file, automatically one migration file generated. But how to delete table. what command need to fire? Do I need to delete complete class file & also remove following line from Context […]

Interception not working as expected with Entity Framework 6

I’m trying to follow the interception example shown here to get it working with EF 6 but running into a problem with the function RewriteFullTextQuery as shown in Figure 1. The interception seems to work but it does not actually execute the logic in the for loop of the RewriteFullTextQuery method because the cmd.Parameters.Count is […]

Update SQL Table from excel file with

I’ve written a little programm which gets an .xlsx file in input (this file is periodically updated), and it extracts the data to an sql table. I would like to periodically update this sql table by comparing the content of the excel file with the content of sql table, and insert into it all the […]

SQL Server: Insert row with trigger after Insert

I’m trying to insert another row into a table whenever a row is inserted using a trigger, but get the following error message: The target table ‘EDDSDBO.Redaction’ of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause. Any help creating a work-around for this would be […]

SQL Server match two columns by different strings

So I have two tables: Expected: Id numberOfItems date And Reality: Id numberOfItems date And I want to get, for each month, sum of Expected.numberOfItems and sum of Reality.numberOfItems. The problem I have is that while is a datetime, is an int with a YYYYMM format. My guess is I need to match […]

Can both a table and indexed view be columnstore?

I have a data warehouse fact table with millions of records and it is a clustered columnstore table. I want to have an Indexed View of the table which casts numeric values of a Text column to numbers and text values of the same column to blanks, for faster performance. If I create the View […]

How to return 0 or 1 to check available number in a range in sql?

I am writing a stored procedure where i want to check available number in a range. The stored procedure will return 0 or 1 as bit. Case 0 means, the number is not available Case 1 means, the number is available. I have written this query Declare @recivedNo As INT = 82 Declare @minSourceNo as […]

How to use python statement to check the sql table is exist or not.?

I would like to know how to write the python statement to check whether the sql table is exist or not. if the table is exist , then I will insert data to the table, otherwise, I will create the table. The table name is “resulttable”, db = MySQLdb.connect(“localhost”,”root”,”123″,”test”) cursor = db.cursor() sql=”””CREATE TABLE resulttable […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.