Search Results

Search found 4908 results on 197 pages for 'ssas 2005'.

Page 88/197 | < Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >

  • Find Date From Non Contiguous Ranges

    - by AGoodDisplayName
    I am looking to find an best way to find a date from date ranges that may or may not be contiguous (I am trying to avoid a cursor, or a heavy function if possible). Lets say I have hotel guests that come and go (check in, check out). I want to find the date that a certain guest stayed their 45th night with us. The database we use records the data as so: Create Table #GuestLog( ClientId int, StartDate DateTime, EndDate DateTime) Here is some data Insert Into #GuestLog Values(1, '01/01/2010', '01/10/2010') Insert Into #GuestLog Values(1, '01/16/2010', '01/29/2010') Insert Into #GuestLog Values(1, '02/13/2010', '02/26/2010') Insert Into #GuestLog Values(1, '04/05/2010', '06/01/2010') Insert Into #GuestLog Values(1, '07/01/2010', '07/21/2010') So far I can only think of solutions that involve functions with temp tables and crazy stuff like that, I feel like I'm over thinking it. Thanks ahead of time.

    Read the article

  • using PIVOT to sql server.

    - by NoviceToDotNet
    This is the abstract idea which i want to do by my first select of first line, i am presenting here, but i am unable to do that correct. here category[0], category[2]..etc representing the category columns values...i know this kind of syntax not work, but i want to do something like this. SELECT category[0], category[1], category[2], category[3], category[4], category[5] FROM( select Row_number() OVER(ORDER BY (SELECT 1)) AS 'Serial Number', EP.FirstName,Ep.LastName, Ep.SignUpID, [dbo].[GetBookingRoleName](ES.UserId,EP.BookingRole) as RoleName, (select top 1 convert(varchar(10),eventDate,103)from [3rdi_EventDates] where EventId=@ItemId) as EventDate, (CASE [dbo].[GetBookingRoleName](ES.UserId,EP.BookingRole) WHEN 'Employee - Marketing' THEN 'DC' WHEN 'Employee - Accounting' THEN 'DC' WHEN 'Coaches' THEN 'DC' WHEN 'Student Client' THEN 'ST' WHEN 'Guest Doctor' THEN 'GDC' ---....more categories here, i just removed a few END) as Category from [3rdi_EventParticipants] as EP inner join [3rdi_EventSignup] as ES on EP.SignUpId = ES.SignUpId WHERE EP.EventId = @ItemId AND EP.PlaceStatus IN (0,3,4,8) and userid in( select distinct userid from userroles where roleid not in(19,20,21,22) and roleid not in(1,2, 25, 44)) (My Below Query) PIVOT(sum(First_Name+Last_Name)) FOR Category (category[0], category[1], category[2], category[3], category[4], category[5]) Group by (SignUpID)

    Read the article

  • How to work with CTE. There is some error related to anchor.

    - by Shantanu Gupta
    I am creating a hierarchy representaion of a column. But an error occurs Details are Msg 240, Level 16, State 1, Line 1 Types don't match between the anchor and the recursive part in column "DISPLAY" of recursive query "CTE". I know there is some typecasting error. But I dont know how to remove error. Please just dont only sort out my error. I need explanation why this error is coming. When this error occurs. I am trying to sort table on the basis of sort col that i m introducing. I want to add '-' at every level and want to sort accordingly. Please help WITH CTE (PK_CATEGORY_ID, [DESCRIPTION], FK_CATEGORY_ID, DISPLAY, SORT, DEPTH) AS ( SELECT PK_CATEGORY_ID, [DESCRIPTION], FK_CATEGORY_ID, '-' AS DISPLAY, '--' AS SORT, 0 AS DEPTH FROM dbo.L_CATEGORY_TYPE WHERE FK_CATEGORY_ID IS NULL UNION ALL SELECT T.PK_CATEGORY_ID, T.[DESCRIPTION], T.FK_CATEGORY_ID, CAST(DISPLAY+T.[DESCRIPTION] AS VARCHAR(1000)), '--' AS SORT, C.DEPTH +1 FROM dbo.L_CATEGORY_TYPE T JOIN CTE C ON C.PK_CATEGORY_ID = T.FK_CATEGORY_ID --SELECT T.PK_CATEGORY_ID, C.SORT+T.[DESCRIPTION], T.FK_CATEGORY_ID --, CAST('--' + C.SORT AS VARCHAR(1000)) AS SORT, CAST(DEPTH +1 AS INT) AS DEPTH --FROM dbo.L_CATEGORY_TYPE T JOIN CTE C ON C.FK_CATEGORY_ID = T.PK_CATEGORY_ID ) SELECT PK_CATEGORY_ID, [DESCRIPTION], FK_CATEGORY_ID, DISPLAY, SORT, DEPTH FROM CTE ORDER BY SORT

    Read the article

  • How to do number formatting to 1 decimal point in SSRS?

    - by san
    Hi, I have a SSRS report with full of number fields. I would like to have that to be displayed as in one decimal. i tried to use F1. it gives me only one decimal points in html rendering, but in excel exported version it shows 2 decimal points. How can i have just one decimal point both ecxel and html rendering. Please comment. Thanks in advance San

    Read the article

  • Using parameterized function calls in SELECT statements. SQL Server

    - by geekzlla
    I have taken over some code from a previous developer and have come across this SQL statement that calls several SQL functions. As you can see, the function calls in the select statement pass a parameter to the function. How does the SQL statement know what value to replace the variable with? For the below sample, how does the query engine know what to replace nDeptID with when it calls, fn_SelDeptName_DeptID(nDeptID) nDeptID IS a column in table Note. SELECT STATEMENT: SELECT nCustomerID AS [Customer ID], nJobID AS [Job ID], dbo.fn_SelDeptName_DeptID(nDeptID) AS Department, nJobTaskID AS JobTaskID, dbo.fn_SelDeptTaskDesc_OpenTask(nJobID, nJobTaskID) AS Task, nStandardNoteID AS StandardNoteID, dbo.fn_SelNoteTypeDesc(nNoteID) AS [Note Type], dbo.fn_SelGPAStandardNote(nStandardNoteID) AS [Standard Note], nEntryDate AS [Entry Date], nUserName as [Added By], nType AS Type, nNote AS Note FROM Note WHERE nJobID = 844261 ORDER BY nJobID, Task, [Entry Date] ====================== Function fn_SelDeptName_DeptID: ALTER FUNCTION [dbo].[fn_SelDeptName_DeptID] (@iDeptID int) RETURNS varchar(25) -- Used by DataCollection for Job Tracking -- if the Deptartment isnt found return an empty string BEGIN -- Return the Department name for the given DeptID. DECLARE @strDeptName varchar(25) IF @iDeptID = 0 SET @strDeptName = '' ELSE BEGIN SET @strDeptName = (SELECT dName FROM Department WHERE dDeptID = @iDeptID) IF (@strDeptName IS NULL) SET @strDeptName = '' END RETURN @strDeptName END ========================== Thanks in advance.

    Read the article

  • LINQ saving images to varbinary

    - by m4rc
    I'm having issues saving images to a varbinary(Max) field using LINQ. I can save files in the region of 10KB to the database no problems, but when it comes to files bigger than that, it's as though it doesn't even try. I've had a look in the SQL Server Profiler and when the file is around 10KB I can see the full insert statement in the detail pane. However, when the file is a bit bigger, the detail pane doesn't show anything, although any data besides the varbinary field is written to the database. The data is in the Data Object just before SubmitChanges so I can't figure out what's happening between now and then!

    Read the article

  • is this a problem in the sp_rename function or sql server itself ?

    - by user81967
    While renaming the column name, the square bracket is included in the column name, which I think is a bug, Here is a sample code snippet, create table [TestTable] (TestColumnName nvarchar(30)) select TestColumnName from TestTable sp_rename '[TestTable].[TestColumnName]', '[RenamedColumnName]', 'Column' select [RenamedColumnName] from TestTable -- does not work "Invalid column name 'RenamedColumnName'." select RenamedColumnName from TestTable -- does not work "Invalid column name 'RenamedColumnName'." select * from [TestTable] -- works fine!!! The bug here is that the column rename includes the square brackets, I found this which says that the "first character must be one of the following", but "[" does not seem be included in the list, can there be a problem with sp_rename or sql server itself, as it allows alteration of column name to start with a square bracket.

    Read the article

  • How do I view Visual Studio BuildLog.htm files without cutting and pasting into an external browser

    - by bgoodr
    This may or may not be specific to VS2005 (as that is the version I'm referring to for this question). I find often the case is that I see this in the Output panel inside Visual Studio 2>Build log was saved at "file://c:\\vsdll_example\MyExecRefsDll\Debug\BuildLog.htm" Now, since that looks and smells like a URL, I would have thought that I could simply left mouse click on it, or left mouse double-click on it, and a browser window of some sort would be displayed. No, that doesn't work. So, to view it, I have to cut and paste the "file://bla/bla/bla" part into an external window. Is there a way to set up Visual Studio to allow me to browse to that file directly, or view it inside Visual Studio IDE, or something to that effect, without the extra fiddling with cutting and pasting? Or is there some type of keybinding I'm not aware of? Thanks, bg

    Read the article

  • Table index design

    - by Swoosh
    I would like to add index(s) to my table. I am looking for general ideas how to add more indexes to a table. Other than the PK clustered. I would like to know what to look for when I am doing this. So, my example: This table (let's call it TASK table) is going to be the biggest table of the whole application. Expecting millions records. IMPORTANT: massive bulk-insert is adding data in this table table has 27 columns: (so far, and counting :D ) int x 9 columns = id-s varchar x 10 columns bit x 2 columns datetime x 5 columns INT COLUMNS all of these are INT ID-s but from tables that are usually smaller than Task table (10-50 records max), example: Status table (with values like "open", "closed") or Priority table (with values like "important", "not so important", "normal") there is also a column like "parent-ID" (self - ID) join: all the "small" tables have PK, the usual way ... clustered STRING COLUMNS there is a (Company) column (string!) that is something like "5 characters long all the time" and every user will be restricted using this one. If in Task there are 15 different "Companies" the logged in user would only see one. So there's always a filter on this one. Might be a good idea to add an index to this column? DATE COLUMNS I think they don't index these ... right? Or can / should be?

    Read the article

  • Accented character regex

    - by user314573
    I'm trying to create a regex that will look for french words whether a user specifies the accented characters or not. So if the the user has searched for "déclaré" but types in declare instead I would like to be able to match the text still. I'm having difficulty making this more dynamic so that it can be matched on any french word... Closest example from another user from a different post was: d[eèéê]cl[aàáâ]r[eèéê] Is it even possible to write a regex for something like this? Any advice would be much appreciated.

    Read the article

  • How to write a simple Lexer/Parser with antlr 2.7?

    - by Burkhard
    Hello, I have a complex grammar (in antlr 2.7) which I need to extend. Having never used antlr before, I wanted to write a very simple Lexer and Parser first. I found a very good explanation for antlr3 and tried to adapt it: header{ #include <iostream> using namespace std; } options { language="Cpp"; } class P2 extends Parser; /* This will be the entry point of our parser. */ eval : additionExp ; /* Addition and subtraction have the lowest precedence. */ additionExp : multiplyExp ( "+" multiplyExp | "-" multiplyExp )* ; /* Multiplication and addition have a higher precedence. */ multiplyExp : atomExp ( "*" atomExp | "/" atomExp )* ; /* An expression atom is the smallest part of an expression: a number. Or when we encounter parenthesis, we're making a recursive call back to the rule 'additionExp'. As you can see, an 'atomExp' has the highest precedence. */ atomExp : Number | "(" additionExp ")" ; /* A number: can be an integer value, or a decimal value */ number : ("0".."9")+ ("." ("0".."9")+)? ; /* We're going to ignore all white space characters */ protected ws : (" " | "\t" | "\r" | "\n") { newline(); } ; It does generate four files without errors: P2.cpp, P2.hpp, P2TokenTypes.hpp and P2TokenTypes.txt. But now what? How do I create a working programm with that? I tried to add these files to a VS2005-WinConsole-Project but it does not compile: p2.cpp(277) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

    Read the article

  • How to create schema that have an access as that of dbo and can be accessed by sa user

    - by Shantanu Gupta
    I am new to schema, roles and user management part in sql server. Till now I used to work with simple dbo schema but now after reading few articles I am intrested in creating schema for managing my tables in a folder fashion. At present, I want to create a schema where i want to keep my tables that have same kind of functionality. When I tries to create a schema then I faces a problem while using query, permissions etc. First of all i want to get used to of using schemas then only I want to explore it. But due to initial stages and work pressure as well i m not able to implement it yet. What can i do to start using schema with default permissions as that of dbo. Also let me know about creating roles and assigning roles on these schema. I want all this to be accessible by sa user itself at present. What is the concept behind all these things

    Read the article

  • Paging in SQL Server problems

    - by Manh Trinh
    I have searched for paging in SQL Server. I found most of the solution look like that What is the best way to paginate results in SQL Server But it don't meet my expectation. Here is my situation: I work on JasperReport, for that: to export the report I just need pass the any Select query into the template, it will auto generated out the report EX : I have a select query like this: Select * from table A I don't know any column names in table A. So I can't use Select ROW_NUMBER() Over (Order By columsName) And I also don't want it order by any columns. Anyone can help me do it? PS: In Oracle , it have rownum very helpful in this case. Select * from tableA where rownum > 100 and rownum <200 Paging with Oracle

    Read the article

  • Incorrect syntax near the keyword 'select' while execuing query

    - by sam
    I am getting Incorrect syntax near the keyword 'select' after executing the following code. declare @c int SELECT @c = COUNT(*) FROM (select id, max(date_stored) from table B INNER JOIN table P ON B.id = P.id where id = 3) select @c I want to select total no of records having max stored dates in database. Can any one plz tell what I am doing wrong

    Read the article

  • Help ! How do I get the total number rows from my mssql paging procedure ?

    - by The_AlienCoder
    Ok I have a table in my MSSQL database that stores comments. My desire is to be able to page though the records using [Back],[Next], page numbers & [Last] buttons in my datalist. I figured the most efficient way was to use a stored procedure that only returns a certain number of rows within a partcular range. Here is what I came up with @PageIndex INT, @PageSize INT, @postid int AS SET NOCOUNT ON begin WITH tmp AS ( SELECT comments.*, ROW_NUMBER() OVER (ORDER BY dateposted ASC) AS Row FROM comments WHERE (comments.postid = @postid)) SELECT tmp.* FROM tmp WHERE Row between (@PageIndex - 1) * @PageSize + 1 and @PageIndex*@PageSize end RETURN Now everything works fine and I have been able implement [Next] and [Back] buttons in my datalist pager.Now I need the total number of all comments(not in the cuurent page) so that I can implement my page numbers and the[Last] button on my pager. In other words I want to return the total number of rows in my first select statement i.e WITH tmp AS ( SELECT comments.*, ROW_NUMBER() OVER (ORDER BY dateposted ASC) AS Row FROM comments WHERE (comments.postid = @postid)) set @TotalRows = @@rowcount @@rowcount doesnt work and raises an error.I also cant get count.* to work either. Is there another way to get the total amount of rows or is my approach doomed.

    Read the article

  • Dynamic order by without using dynamic sql ?

    - by Rohit
    I have the following stored procedure which can be sorted ascending and descending on TemplateName,CreatedOn and UploadedBy. The following SP when runs doesnot sort records.if i replace 2,3,4 by columnname, i got an error message "Conversion failed when converting the nvarchar value 'Test Template' to data type int.".Please suggest how to achieve sorting. CREATE PROCEDURE [dbo].[usp_SEL_GetRenderingTemplate] ( @facilityID INT, @sortOrder VARCHAR(5), @sortExpression VARCHAR(100), @errorCode INT OUTPUT ) AS BEGIN SET NOCOUNT ON ; BEGIN TRY SET @sortOrder = CASE @sortOrder WHEN 'Ascending' THEN 'ASC' WHEN 'Descending' THEN 'DESC' ELSE 'ASC' END SELECT TemplateID, TemplateName, CreatedOn, ( [user].LastName + ' ' + [user].FirstName ) AS UploadedBy FROM Templates INNER JOIN [user] ON [user].UserID = Templates.CreatedBy WHERE facilityid = @facilityID ORDER BY CASE WHEN @sortExpression = 'TemplateName' AND @sortOrder = 'ASC' THEN 2 WHEN @sortExpression = 'CreatedOn' AND @sortOrder = 'ASC' THEN 3 WHEN @sortExpression = 'UploadedBy' AND @sortOrder = 'ASC' THEN 4 END ASC, CASE WHEN @sortExpression = 'TemplateName' AND @sortOrder = 'DESC' THEN 2 WHEN @sortExpression = 'CreatedOn' AND @sortOrder = 'DESC' THEN 3 WHEN @sortExpression = 'UploadedBy' AND @sortOrder = 'DESC' THEN 4 END DESC SET @errorCode = 0 END TRY BEGIN CATCH SET @errorCode = -1 DECLARE @errorMsg AS VARCHAR(MAX) DECLARE @utcDate AS DATETIME SET @errorMsg = CAST(ERROR_MESSAGE() AS VARCHAR(MAX)) SET @utcDate = CAST(GETUTCDATE() AS DATETIME) EXEC usp_INS_LogException 'usp_SEL_GetFacilityWorkTypeList', @errorMsg, @utcDate END CATCH END

    Read the article

  • Select a column returned by a stored procedure

    - by vaibhav
    I have a stored procedure which is returning me about 50 columns. I want to write a query, where I will be able to select a particular column from the list of column returned by the SP. I tried writing select RSA_ID from exec(uspRisksEditSelect '1') But Its throwing me an error. I think we need to write some dynamic sql for it. But I am new to it.

    Read the article

  • Visual Studio - How to use an existing vsproj's project settings as a template for new project?

    - by Jakobud
    There is some software I want to write a plugin for. The software includes some sample plugins. I want to create a new fresh project but I want to use one of the sample plugin vsproj's project settings as a template. It doesn't seem very clear on how to do this. If I do "New Project From Existing Code" that only imports the cpp, h, etc files into the new project. Right now the only way I can see to copy a sample projects settings is to open two instances of VS2005 next to each other and simply mimic the settings... Surely there is a built in method of doing this?

    Read the article

  • Attaching catalog with SQL Authentication credentials attaches it as Read-Only

    - by Nissim
    Hello, As part of our product's installation process, a database is attached to the server. We use EXEC sp_attach_db in order to attach it to MSSQL. The problem occures when we try to attach it with "SQL Authentication" connection string - the database is attached to the server as read-only, thus preventing any write access from being performed This is driving us nuts... it's working just fine with Windows Authentication, and the only difference is the connection string... I tried googling for it but no mention for such a scenario is found. Any ideas anyone? It's important to mention that the MDF/LDF physical files are not set with "ReadOnly" attribute, so this is not the problem.

    Read the article

< Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >