Help with SQL Server query
I have table that contain name and date. I need to count how many names I have in a one day, and make average to all days. How to do it? Thanks in advance ...
I have table that contain name and date. I need to count how many names I have in a one day, and make average to all days. How to do it? Thanks in advance ...
I have only SQL Server 2008R2 installed though I need to communicate with customers having 2005. [1] tells: "NOLOCK This does not lock any object. This is the default for SELECT operations. It does not apply to INSERT, UPDATE, and DELETE statements" [2] doesn't seem to mention it, but my checking in SSMS/SS 2008R2 shows that n...
I have the following CTE SQL WITH Tasks AS ( SELECT TaskID, ParentTaskID, CAST(SortKey AS nChar) AS sort_key /*,cast(SortKey as char) as sort_key */ FROM oaTasks AS s WHERE (TaskID = 1) UNION ALL SELECT s2.TaskID, s2.ParentTaskID ,Cast( '0.'+ cast(Tasks_2.sort_key as...
Both of these work individually SELECT PONumber, count(RequestNumber) as "InNumOfRequests", sum(Amount) as "SumofAmounts" FROM tableView GROUP BY PONumber SELECT DISTINCT PONumber, (10 * ceiling((DATEDIFF(day,POApprovedDate,GETDATE()))/10)) AS "BINofDaysSincePOApproved" ...
Is there an easy tutorial? I'd like to create a table that exactly matches the excel table, is it possible to do something like "create table from excel sheet"? ...
Can I install and use sql server 2005 and 2008 in the same time on the same machine because I have an old software that use SQL server 2005 and another new one that use Sql server 2008 ...
Hi, Stage1 My web portal checks if there is a csv file selected and then uploads a csv file through file upload option saving i tonto a tempdatabase on sql Server and displays the data on the grid view. The grid view contain fixed 29 columns with a hyperlink named (view) and a check field. Stage 2 & 3 What I want is, once the file ...
Hi, Does any one has an idea of whats the best practice to store an unknown data type in a table. Basically I would need to store types like bit, smallint, int, real and nvarchar in the same "value" column, for later interpretation by a .NET application. I was trying to achieve the best possible solution not to compromise the performan...
I need to create an audit to track all CRUD events for all the tables in a database , now i have more than 100 tables in the DB , is there a way to create the specification which will include all the tables in the DB ? P.S : I am using SQL Server 2008 ...
Table can have trigger on insert/delete/update. Trigger will be fired internally by DB engine. Is it possible to pass a parameter to trigger in SQL server database like StoreProcedure? ...
On our dev boxes, our database resides entirely in the PRIMARY filegroup, and everything works fine. On one of our production servers, recently upgraded from 2005 to 2008, we noticed it was performing slower than it should. On this machine, there are two filegroups - PRIMARY and INDEXES. Both filegroups contain 1 file per logical vo...
What kind of basic management/audit scripts do you run in your databases or in an instance? There may be lots of them, but I would like to know (get hints) what kind of task would be most valuable when managing databases or an instance. And also what kind of reporting do you have from your databases (in a management perspective)? ...
I have noticed quite a few mentions of the word "materializing" when people are talking about using temporary tables in SQL Server. Can someone expand on what it is that means? I am just trying to get a better understanding of what that means in terms of using temp tables? Thanks! S ...
I've been using SQL Server 2008 R2 for my development. I noticed that service pack 2 for SQL Server 2008 just came out. However, I checked here and Microsoft does not provide a link to any of the service packs for SQL Server 2008 R2. So it is not clear to me whether or not I should apply their service pack to my instance of SQL Server 20...
Hi folks, I have the following sql query for a SQL Server 2008 db. SELECT TOP(@NumberOfStreetResults) LocationType, LocationId, Name FROM [dbo].[LocationNames] WHERE CONTAINS(Name, @SearchQuery) AND LocationType = 7 Notice how I'm using the CONTAINS keyword? I have an FTS on the Name field. I'm not sure what index(s) I need to ...
Hi, Im using sql server 2008 database on the server side but I want to give customers possibility to hold local database (using sql server 2008 CE). Before migrating to 2005 I was manually writing scripts to create local CE database. Is there any way to automate this task in sql server 2008 ? Maybe its common problem ? thanks for he...
I have setup a DDL trigger @ Database level to capture all DDL changes and to log them into a Table. When I issue a Dynamic SQL statment such as set @sql="SELECT * INTO __Temp__XLPriceList FROM OpenDataSource('Microsoft.ACE.OLEDB.12.0','Data Source="\\DEV-v1\d$\DEV-V1\EXCEL_BOOKS\EXPRESSLANE\DISCOUNTS\08Oct10-DISCOUNT-010-141.XLS"; ...
How to change one attribute in a table using T-SQL to allow nulls (not null --> null)? Alter table maybe? ...
Is it possible to add global variables that are shared among reports in SQL Server Reporting Services? I know it's possible to add variables for a report but I want the same variables to be used from many different reports. Also, is it possible to have different configurations for different servers so that when reports are deployed they...
I'am developing a software based on Entity Framework to handle data in a MS SQL Server 2008 database. [Trouble 1] I've just tried to insert some small data (about 2 Mb) from my progam to the database : the performance are very bad ! It takes more than 1 minute to insert these datas ! I've try to generate pre-compiled views, I've got t...