How can i store latitude and longitude (of registered user locations) in sql server and how can i query it for finding locations inside X radius from point y (or any user)?
Hello
In my app (WP 8.1) i have to store user location (lat,lon) in sql db so how can i store that location detail? And i also have to find all the location which are inside certain radius X from another user location, How can i do this?
Any Sample project or code or any blog post?
P.S. I use sql server 2012.
If you need to do spatial queries like the one you mentioned you'd need to store it as a spatial geography type. For points, a simple SQL INSERT statement using the Point() method would do it. Example here:
http://msdn.microsoft.com/en-us/library/bb933811.aspx For locations inside a radius, you'd use STDistance() method. All of the methods for the geography data type are documented here:
http://msdn.microsoft.com/en-us/library/bb933802.aspx and can be used in ordinary T-SQL statements.
If you need to use the SQL Server spatial library in your .NET application direct, Alastair has some nice blog posts, like this one:
https://alastaira.wordpress.com/2011/08/19/spatial-applications-in-windows-azure-redux-including-denali/ , he even wrote a book. Or search the answers in this forum.
Hope this helps, Bob
Similar Messages
-
I have a scenario with the three nodes with server 2012 standard, each running an instance of SQL Server 2012 enterprise, participate in a
single Windows Server Failover Cluster (WSFC) that spans two data centers.
If the nodes in the primary data center are unavailable due to data center outage. Then how I can able to access node in the WSFC (Windows Server Failover Cluster) in the secondary disaster recovery data center automatically with some script.
I want to write script that can be able to check primary data center by pinging some IP after every 5 or 10 minutes.
If that IP is unable to respond then script can be able to Perform Forced Manual Failover of Availability Group (SQL Server) and WSFC (Windows Server Failover Cluster)
Can you please guide me for script writing for automatic failover in case of primary datacenter outage?please post you question on failover clusters in the cluster forum. THey will explain how this works and point you at scipts.
You should also look in the Gallery for cluster management scripts.
¯\_(ツ)_/¯ -
I have a scenario with the three nodes with server 2012 standard, each running an instance of SQL Server 2012 enterprise, participate in a
single Windows Server Failover Cluster (WSFC) that spans two data centers.
If the nodes in the primary data center are unavailable due to data center outage. Then how I can able to access node in the WSFC (Windows Server Failover Cluster) in the secondary disaster recovery data center automatically with some script.
I want to write script that can be able to check primary data center by pinging some IP after every 5 or 10 minutes.
If that IP is unable to respond then script can be able to Perform Forced Manual Failover of Availability Group (SQL Server) and WSFC (Windows Server Failover Cluster)
Can you please guide me for script writing for automatic failover in case of primary datacenter outage?You are trying to implement manually what should be happening automatically in the cluster. If the primary SQL Server becomes unavailable in the data center, it should fail over to the secondary SQL Server automatically. Is that not working?
You also might want to run this configuration by some SQL experts. I am not a SQL expert, but if you have both hosts in the data center in a cluster, there is no need for replication between those two nodes as they would be accessing
the database from some form of shared storage. Then it looks like you are trying to implement Always On to the DR site. I'm not sure you can mix both types of failover in a single configuration.
FYI, it would make more sense to establish a file share witness in your DR site instead of placing a third node in the data center for Node Majority quorum.
. : | : . : | : . tim -
SQL server support or can store data in multiple languages? If so, how is it done
Hi All,
Can you please let me know If SQL server support or can store data in multiple languages? If so, how is it done..
Thanks,
Subbu
Thanks, SubbuYes, you have to use Unicode data types such as nchar and nvarchar to store the data. See https://technet.microsoft.com/en-us/library/ms191200(v=sql.105).aspx
Satish Kartan www.sqlfood.com -
My friend installed intunes and registered his ipod on my computer. Now I bought my own ipod and like to register mine also on my computer. How can I do this?
Simply hook it up to iTunes and register it the same way you did with your friends iPod. Nothing more than that. There is NO limit to the number of iPods, iPhones, or iPads you can sync to one computer, iTunes library, or account.
B-rock -
I'd like to know how can i connect my old iMac tiger with new one iMac lion. I wanna use the old one for external disk to collect files from there to new one.
Hi mshields1162,
Great question, and welcome to Apple Support Communities.
First, you may want to choose to have the sidebar displayed for familiarity:
iTunes 11: Frequently used features
http://support.apple.com/kb/HT5649
Afterwards, your device should be displayed if connected:
We'll want to click on it, and choose the Music tab at the top. Let's make sure "Sync Music" is checked:
Afterwards, you'll have the option to sync either the entire music library (for your first iPod), or "Selected playlists, artists, albums, and genres" (for the secondary device). Upon selecting this option, four larger option boxes will appear allowing you to pick and choose what content will be synced. For audiobooks, you may need to do the above in the "Books" section. For a visual instruction on how to do this, see the following:
iTunes 10: Sync to your iPod
http://support.apple.com/kb/VI72
Thanks,
Matt M. -
Hello, how are you? On September 13 I bought an iPad and in October bought a game on the app store problem is that when informed the card number dropped normally, but then went on to ask for a new form of payment because one had given any errors, and so not lowered any other game and not upgraded the already downloaded. I do not know what exactly I have to do, because if informed a new payment method continues with the same problem, checked the card bill and really had given an error, because there was no billed the game. I ask you to verify what happened and explain to me what I need to do, because my single card is Visa's and do not intend to return others to use the services of the App Store.
Thank you for understanding.I think you need the app store support. http://www.apple.com/support/mac/app-store/contact/ Go there and use one of the methods to contact them about your issue and they should be able to help you out.
This forum isn't checked by Apple employees but is for users to help each other out.
Phil -
Hi,
We need to migrate Our current 1 clustered SQL Server, Many Configurations DataBases and Many Content DataBases to a brand new clustered SQL server and brand new databases in it.
How can I do this?
Can someone list the steps involved?
Thanks.Hi,
According to your description, you want to move Content databases and Configuration databases to a new SQL Server, refer to this article:
https://technet.microsoft.com/en-us/library/cc512725.aspx?f=255&MSPPError=-2147217396
Besides, here is a similar post, you can use as a reference:
https://social.technet.microsoft.com/Forums/office/en-US/2cd46f7a-d583-41b2-82c2-ddc6d7c43fb8/how-to-move-sharepoint-databases-to-new-sql-server?forum=sharepointadminprevious
Best Regards,
Lisa Chen
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
One of server core 12 and showing in sql server 24. how it possible?
Hello everyone,
I'm confused in sql server 2008 r2 when try to check no. of cores in sql server property are double in sql server and os showing 12 cores.
one of my friend saying 1 cores= 2 processors.
What is happen behind that...
Thanks in advance...Hi,
Are you same person Baraiya Krit who posted below same question I have always observed question posted by you and Baraiya are same. if such is the case
both should be merged and you should note not to post same question with different profile otherwise i have to report that as spam and your profile would be deleted. If such is case you are wasting people time
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/505a2871-a7fd-487e-b39d-788ff78b6c95/one-of-server-core-12-and-showing-in-sql-server-24-how-it-possible?forum=sqldatabaseengine
If you are from same firm and different person why not post one question.
Moderators please have a look
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Articles -
Hi all,
I used the following code to create a new Database (ScottChangDB) and a new Table (marvel) in my SQL Server 2012 Management Studio (SSMS2012) successfully:
-- ScottChangDB.sql saved in C://Documents/SQL Server XQuery_MacLochlainns Weblog_code
-- 14 April 2015 09:15 AM
USE master
IF EXISTS
(SELECT 1
FROM sys.databases
WHERE name = 'ScottChangDB')
DROP DATABASE ScottChangDB
GO
CREATE DATABASE ScottChangDB
GO
USE ScottChangDB
CREATE TABLE [dbo].[marvel] (
[avenger_name] [char] (30) NULL, [ID] INT NULL)
INSERT INTO marvel
(avenger_name,ID)
VALUES
('Hulk', 1),
('Iron Man', 2),
('Black Widow', 3),
('Thor', 4),
('Captain America', 5),
('Hawkeye', 6),
('Winter Soldier', 7),
('Iron Patriot', 8);
SELECT avenger_name FROM marvel ORDER BY ID For XML PATH('')
DECLARE @x XML
SELECT @x=(SELECT avenger_name FROM marvel ORDER BY ID FOR XML PATH('Marvel'))--,ROOT('root'))
SELECT
person.value('Marvel[4]', 'varchar(100)') AS NAME
FROM @x.nodes('.') AS Tbl(person)
ORDER BY NAME DESC
--Or if you want the completed element
SELECT @x.query('/Marvel[4]/avenger_name')
DROP TABLE [marvel]
Now I am trying to create my first XML Schema Collection to do the Validation on the Field Name (Column Title) of the "marvel" Table. I have studied Chapter 4 XML SCHEMA COLLECTIONS of the book "Pro SQL Server 2008 XML" written by
Michael Coles (published by Apress) and some beginning pages of XQuery Language Reference, SQL Server 2012 Books ONline (published by Microsoft). I mimicked Coles' Listing 04-05 and I wanted to execute the following first-drafted sql in
my SSMS2012:
-- Reference [Scott Chang modified Listing04-05.sql of Pro SQL Server 2008 XML by Michael Coles (Apress)]
-- [shcColes04-05.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress]
-- [executed: 2 April 2015 15:04 PM]
-- shcXMLschemaTableValidate1.sql in ScottChangDB of SQL Server 2012 Management Studio (SSMS2012)
-- saved in C:\Documents\XQuery-SQLServer2012
tried to run: 15 April 2015 ??? AM
USE ScottChangDB;
GO
CREATE XML SCHEMA COLLECTION dbo. ComplexTestSchemaCollection_all
AS
N'<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="marvel">
<xsd:complexType>
<xsd:all>
<xsd:element name="avenger_name" />
<xsd:element name="ID" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>';
GO
DECLARE @x XML (dbo. ComplexTestSchemaCollection_all);
SET @x = N'<?xml version="1.0"?>
<marvel>
<avenger_name>Thor</name>
<ID>4</ID>
</marvel>';
SELECT @x;
GO
DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_all;
GO
I feel that drafted sql is very shaky and it needs the SQL Server XML experts to modify to make it work for me. Please kindly help, exam the coding of my shcXMLTableValidate1.sql and modify it to work.
Thanks in advance,
Scott ChangHi Scott,
2) Yes, FOR XML PATH clause converts relational data to XML format with a specific structure for the "marvel" Table. Regarding validate all the avenger_names, please see below
sample.
DECLARE @x XML
SELECT @x=(SELECT ID ,avenger_name FROM marvel FOR XML PATH('Marvel'))
SELECT @x
SELECT
n.value('avenger_name[1]','VARCHAR(99)') avenger_name,
n.value('ID[1]','INT') ID
FROM @x.nodes('//Marvel') Tab(n)
WHERE n.value('ID[1]','INT') = 1 -- specify the ID here
--FOR XML PATH('Marvel') --uncommented this line if you want the result as element type
3)i.check the xml schema content
--find xml schema collection
SELECT ss.name,xsc.name collection_name FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
select * from sys.schemas
--check the schema content,use the name,collection_name from the above query
SELECT xml_schema_namespace(N'name',N'collection_name')
3)ii. View can be viewed as virtual table. Use a view to list the XML schema content.
CREATE VIEW XSDContentView
AS
SELECT ss.name,xsc.name collection_name,cat.content
FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
CROSS APPLY(
SELECT xml_schema_namespace(ss.name,xsc.name) AS content
) AS cat
WHERE xsc.name<>'sys'
GO
SELECT * FROM XSDContentView
By the way, it would be appreciated if you can spread your questions into posts. For any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
when i finally connected my mac to work network on windows environment everything related to apple including App store, Safari, software updates, iCloud and iTunes do not work using a proxy server and everything else is working very well including chrome browser…i tried everything but no clue...anybody have solution for this..???
I also forgot to note that this problem also persists with the new iBooks application. I cannot get past the 'Get Started' screen or access the iBooks Store. Again, all top bar menus are unresponsive.
DT -
My Ipod was stolen and was not registered but was joined with an iTunes account can i find it?
If you did not configure FindmyIPod on it, I'm afraid you are out of luck. Report the theft to the local authorities and change the passwords to any and all accounts you have may used/accessed or configured on the iPod Touch.
Reporting a lost or stolen Apple product
B-rock -
SQL Server and TFS integration: can't see TFS SQL Server project
Hi:
From SQL Server Management Studio 2012 FILE-> OPEN FROM SOURCE CONTROL -> SQL Server doesn't recognize the SQL Server Project in TFS I specify; I have carefully checked that the project files are in the path specified. I have placed the solution/project
additionally into the VS Studio 2012 path -> whatever path I point to, SQL Server is unable to open the project and I cannot get to the checked in SQL source. Thank you for your help :)The problem is that SSMS doesn't see existing SQL server projects that are checked into TFS by others; I cannot get my SSMS instance to connect to TFS and see the existing projects and check them out. The tutorial is no help.
Hi,
According to your description, you could not add the project or solution to source control in SQL Server Management Studio 2012. I recommend you if you install and configure the Team Foundation Server MSSCCI Provider successfully. And check if you can launch
the client (File >> Source Control >> Launch Team Foundation server MSSCCI Provider). If yes, I recommend you install
the latest Cumulative Update of SQL Server 2012 , which can be downloaded from Microsoft website.
In addition, if the error still exists, I recommend you post more details about error log for analysis. When you connect to TFS server, we need to verify if you supply the right information and sign-in credentials for your Team Foundation Server .
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
What is available on new Windows servers that allow you to write scripts that can work directly with Windows, SQL Server, and Exchange Server?
a. PowerShell
b. isql
c. osql
d. sqlcmdAll questions seem to be from the interview or a test. I think I even took this test once, it's KForce test.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
Hello,
I use Entity Framework code first approach.
My project is working fine with SQL Server. But, I want to access Oracle too. I want to switch SQL Server and Oracle in run time.
I am able to access Oracle using "Oracle.ManagedDataAccess.EntityFramework.dl" in a new project.
But, Is this possible to access SQL Server and Oracle in the same project.
Thanks,
MuruganThis should be possible with a Code-First workflow. In Code-First the database mapping layer is generated at runtime.
David
David http://blogs.msdn.com/b/dbrowne/
Maybe you are looking for
-
I've been trying fresh installation of SQL Server 2008 R2 enterprise on Windows Server 2012 R2 standard VM server several times for two weeks, but always get the error "Attempted to perform an unauthorized operation". At first, I attempted to install
-
Deploying a J2EE web application in Oracle 10g
Hi friends, <br> I had worked with Oracle9i 9.0.3 . But it's my first experience with Oracle 10g . I have installed Oracle 10g Infrastructure , Metadata Repository and one Middle tier - Forms and i hope i have followed The Oracle 10g installation gui
-
I just purchased Adobe Acrobat XI Pro, but installation didn't work. At the last step said that it'd fund an error. Any idea? How i can contact Adobe support? I have a new Macbook Pro Yosemitte ..
-
Need download for CS2 Premium Education (1131). I have the serial number.
I'm in need of the download for CS2 Premium Education edition 1131-1157-9455-5327-2219-5530. I'm unable to install off my disks due to the online activation process and am unable to find my actual serial number on the CS2 downloads page: https://ww
-
How to check where DB uses ASM or not.
I do not know customer Oracle DB environment well. Customer uses oracle 11g on win2008R2 and OEM is not installed. How could I know whether that DB uses ASM or not ?