Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Server 2008 SMS vs Visual Studio 2010 Server Explorer results
    primarykey
    data
    text
    <p>i am having a problem with my SQL query that I wrote in Sql Server 2008 Express SMS and am using inside of Visual Studio 2010.</p> <p>Basics: There is an input box on a web page. It is used to search for a persons name, address, id, etc. When I use a persons name on the website, or inside of the built in Visual Studio Server Explorer, such as "Kargul" (made up), it won't return any results using my Stored Procedure. <strong>However</strong>, in SQL Server 2008 Express SMS, the same Stored Procedure returns a valid result.</p> <p>Is there something I am missing? Here is my Procedure:</p> <pre><code>SET NOCOUNT ON; DECLARE @vars NVARCHAR(50); SET @vars = '%' + @searchTerm + '%'; SELECT a.PersonId, Stat.StatusId, a.Honorific, a.FirstName, a.LastName, a.Street1, a.Street2, a.City, a.State, a.Zip, a.Phone, a.Email FROM Persons AS a JOIN dbo.PersonStatus as Stat ON a.StatusId = Stat.StatusId WHERE a.FirstName LIKE (@vars) UNION SELECT a.PersonId, Stat.StatusId, a.Honorific, a.FirstName, a.LastName, a.Street1, a.Street2, a.City, a.State, a.Zip, a.Phone, a.Email FROM Persons AS a JOIN dbo.PersonStatus as Stat ON a.StatusId = Stat.StatusId WHERE a.LastName LIKE (@vars) UNION SELECT a.PersonId, Stat.StatusId, a.Honorific, a.FirstName, a.LastName, a.Street1, a.Street2, a.City, a.State, a.Zip, a.Phone, a.Email FROM Persons AS a JOIN dbo.PersonStatus as Stat ON a.StatusId = Stat.StatusId WHERE a.Street1 LIKE (@vars) UNION SELECT a.PersonId, Stat.StatusId, a.Honorific, a.FirstName, a.LastName, a.Street1, a.Street2, a.City, a.State, a.Zip, a.Phone, a.Email FROM Persons AS a JOIN dbo.PersonStatus as Stat ON a.StatusId = Stat.StatusId WHERE a.City LIKE (@vars) UNION SELECT a.PersonId, Stat.StatusId, a.Honorific, a.FirstName, a.LastName, a.Street1, a.Street2, a.City, a.State, a.Zip, a.Phone, a.Email FROM Persons AS a JOIN dbo.PersonStatus as Stat ON a.StatusId = Stat.StatusId WHERE a.PersonId LIKE (@vars) UNION SELECT a.PersonId, Stat.StatusId, a.Honorific, a.FirstName, a.LastName, a.Street1, a.Street2, a.City, a.State, a.Zip, a.Phone, a.Email FROM Persons AS a JOIN dbo.PersonStatus as Stat ON a.StatusId = Stat.StatusId WHERE a.State LIKE (@vars) ORDER BY PersonId; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload