I've written this query with the help of google to create a delimited list from a table but I didn't understand anything from this query. Can anyone explain me what's happening SELECT E1.dept...
I need to add a specific column if it is does not exist. I have something like this, but it always returns false: IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE...
What is the difference between CROSS JOIN AND INNER JOIN CROSS JOIN: SELECT Movies.CustomerID, Movies.Movie, Customers.Age, Customers.Gender, Customers.[Education Level], Customers.[I...
As always, there will be a reasonable explanation for my surprise, but till then.... I have this query delete from Photo where hs_id in (select hs_id from HotelSupplier where id = 142) which ex...
If there is a table called employee EmpID EmpName ---------- ------------- 1 Mary 1 John 1 Sam 2 Alaina 2 Edward ...
I need to know how to make an sql query run daily using sql server agent jobs with minimum required configuration settings.
How can I delete duplicate rows where no unique row id exists? My table is col1 col2 col3 col4 col5 col6 col7 john 1 1 1 1 1 1 john 1 1 1 1 1 1 sally 2 2 2 ...
What's the best way to truncate a datetime value (as to remove hours minutes and seconds) in SQL Server 2008? For example: declare @SomeDate datetime = '2009-05-28 16:30:22' select trunc_date(@SomeD...
I would like to query the name of all columns of a table. I found how to do this in: Oracle MySQL PostgreSQL But I need to know: how can this be done in Microsoft SQL Server (2008 in my case)?
How do I clean up the SQL Server to get rid of expired SqlDependency objects? After I receive the event from the SqlDepedency object, I need to create a new one before I can get a new event. However, ...