All Questions

11
votes
4answers
20250 views

What this query does to create comma delimited list SQL Server?

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...
1462
votes
26answers
905401 views

How to check if a column exists in SQL Server table

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...
90
votes
9answers
244972 views

CROSS JOIN vs INNER JOIN in SQL Server 2008

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...
9
votes
2answers
1026 views

sql server 2008 management studio not checking the syntax of my query

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...
20
votes
4answers
30289 views

SQL group_concat function in SQL Server

If there is a table called employee EmpID EmpName ---------- ------------- 1 Mary 1 John 1 Sam 2 Alaina 2 Edward ...
75
votes
5answers
212578 views

how to schedule a job for sql query to run daily?

I need to know how to make an sql query run daily using sql server agent jobs with minimum required configuration settings.
207
votes
13answers
451336 views

How to delete duplicate rows in sql server?

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 ...
231
votes
13answers
398838 views

How can I truncate a datetime in SQL Server?

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...
460
votes
16answers
1073468 views

How can I get column names from a table in SQL Server?

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)?
9
votes
2answers
3610 views

How do I clean SqlDependency from SQL Server memory?

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, ...

Previous Next