Search Results

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

Page 79/197 | < Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >

  • A table that has relation to itself issue

    - by Mostafa
    Hi , I've defined table with this schema : CREATE TABLE [dbo].[Codings]( [Id] [int] IDENTITY(1,1) NOT NULL, [ParentId] [int] NULL, [CodeId] [int] NOT NULL, [Title] [nvarchar](50) COLLATE Arabic_CI_AI NOT NULL, CONSTRAINT [PK_Codings] PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] And fill it up with data like this : Id ParentId CodeId Title ----------- ----------- ----------- ---------- 1 NULL 0 Gender 2 1 1 Male 3 1 2 Female 4 NULL 0 Educational Level 5 4 1 BS 6 4 2 MS 7 4 3 PHD Now , I'm looking for a solution , in order , When i delete a record that is parent ( like Id= 1 or 4 ), It delete all child automatically ( all records that their ParentId is 1 or 4 ) . I supposed i can do it via relation between Id and Parent Id ( and set cascade for delete rule ) , But when i do that in MMS , the Delete Rule or Update Rule in Properties is disabled . My question is , What can i do to accomplish this ? Thank you

    Read the article

  • how to retrieve distinct values from multiple columns

    - by ANIL MANE
    Hello Experts, I have a flat text file data which I import into MSSQL table. It creates and table with specified name along with multiple columns as per data file. now I need a query which will return the data and its count. e.g. data file : BREAD,MILK BREAD,DIAPER,BEER,EGGS MILK,DIAPER,BEER,COKE BREAD,MILK,DIAPER,BEER BREAD,MILK,DIAPER,COKE BREAD,ICE,MANGO JUICE,BURGER Result should be BREAD | 5 MILK | 4 DIAPER| 4 and so on.

    Read the article

  • C#: proprietary DLLs requiring access to my assemblies

    - by Craig Johnston
    My solution uses a proprietary assembly, which when debugging the solution throws an Exception saying it can't find an assembly that is meant to be one of the projects in my solution. I cannot add a reference to the proprietary assembly because all I have is the DLL. When I compile everything into a single application directory and run the app it works fine, but I want to debug. Where should assemblies be placed if you want a proprietary assembly in the solution to see them? I assume the issue is that there is no path specified and it is just looking in a default directory of some kind.

    Read the article

  • Prepare and import data into existing database

    - by Álvaro G. Vicario
    I maintain a PHP application with SQL Server backend. The DB structure is roughly this: lot === lot_id (pk, identify) lot_code building ======== buildin_id (pk, identity) lot_id (fk) inspection ========== inspection_id (pk, identify) building_id (fk) date inspector result The database already has lots and buildings and I need to import some inspections. Key points are: It's a one-time initial load. Data comes in an Excel file. The Excel data is unaware of DB autogenerated IDs: inspections must be linked to buildings through their lot_code What are my options to do such data load? date inspector result lot_code ========== =========== ======== ======== 31/12/2009 John Smith Pass 987654X 28/02/2010 Bill Jones Fail 123456B

    Read the article

  • service broker message process order

    - by Blootac
    Everywhere I read says that messages handled by the service broker are processed in the order that they arrive, and yet if you create a table, message type, contract, service etc , and on activation have a stored proc that waits for 2 seconds and inserts the msg into a table, set the max queue readers to 5 or 10, and send 20 odd messages I can see in the table that they are inserted out of order even though when I insert them into the queue and look at the contents of the queue I can see that the messages are all in the right order. Is it due to the delay waitfor waiting for the nearest second and each thread having different subsecond times and then fighting for a lock or something? The reason i've got a delay in there is to simulate delays with joins etc Thanks demo code: --create the table and service broker CREATE TABLE test ( id int identity(1,1), contents varchar(100) ) CREATE MESSAGE TYPE test CREATE CONTRACT mycontract ( test sent by initiator ) GO CREATE PROCEDURE dostuff AS BEGIN DECLARE @msg varchar(100); RECEIVE TOP (1) @msg = message_body FROM myQueue IF @msg IS NOT NULL BEGIN WAITFOR DELAY '00:00:02' INSERT INTO test(contents)values(@msg) END END GO ALTER QUEUE myQueue WITH STATUS = ON, ACTIVATION ( STATUS = ON, PROCEDURE_NAME = dostuff, MAX_QUEUE_READERS = 10, EXECUTE AS SELF ) create service senderService on queue myQueue ( mycontract ) create service receiverService on queue myQueue ( mycontract ) GO --********************************************************** --now insert lots of messages to the queue DECLARE @dialog_handle uniqueidentifier BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>1</test>'); BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>2</test>') BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>3</test>') BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>4</test>') BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>5</test>') BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>6</test>') BEGIN DIALOG @dialog_handle FROM SERVICE senderService TO SERVICE 'receiverService' ON CONTRACT mycontract; SEND ON CONVERSATION @dialog_handle MESSAGE TYPE test ('<test>7</test>')

    Read the article

  • Sql Server string to date conversion

    - by JosephStyons
    I want to convert a string like this: '10/15/2008 10:06:32 PM' into the equivalent DATETIME value in Sql Server. In Oracle, I would say this: TO_DATE('10/15/2008 10:06:32 PM','MM/DD/YYYY HH:MI:SS AM') This question implies that I must parse the string into one of the standard formats, and then convert using one of those codes. That seems ludicrous for such a mundane operation. Is there an easier way?

    Read the article

  • Obtain Update Table Lock at start of Stored Procedure in SQL Server

    - by Jim Hurne
    I'm writing a SQL Server stored procedure in which I want to lock a table for update before executing the body of the stored procedure. I don't want to prevent other processes from reading the table, but I do want to prevent other processes updating the table. Here is my first attempt: CREATE PROCEDURE someProcedure BEGIN SET TRANSACTION ISOLATION LEVEL READ COMITTED BEGIN TRANSANCTION SELECT COUNT(*) FROM TheTable WITH (UPDLOCK, TABLOCK) -- Pause procedure so that we can view the locks with sp_lock WAITFOR DELAY '00:15' -- Do stuff COMMIT END When I execute the stored procedure, and invoke sp_lock, I see that the table is indeed locked. However, it's locked with an Exclusive lock instead of an update lock: spid | dbid | ObjId | IndId | Type | Resource | Mode | Status ------------------------------------------------------------------ 63 | 10 | 233208031 | 0 | TAB | | X | GRANT How can I get an update (U) lock instead?

    Read the article

  • Tentative date casting in tsql

    - by Tewr
    I am looking for something like TRYCAST in TSQL or an equivalent method / hack. In my case I am extracting some date data from an xml column. The following query throws "Arithmetic overflow error converting expression to data type datetime." if the piece of data found in the xml cannot be converted to datetime (in this specific case, the date is "0001-01-01" in some cases). Is there a way to detect this exception before it occurs? select [CustomerInfo].value('(//*:InceptionDate/text())[1]', 'datetime') FROM Customers An example of what I am trying to achieve in pseudocode with an imagined tsql function TRYCAST(expr, totype, defaultvalue): select TRYCAST( [CustomerInfo].value('(//*:InceptionDate/text())[1]', 'nvarchar(100)'), datetime, null) FROM Customers

    Read the article

  • Design SQL Query for following case

    - by rs
    Consider tables Table1 id, name 1 xyz 2 abc 3 pqr Table2 id title 1 Mg1 2 Mg2 3 SG1 Table3 Tb1_id tb2_id count 1 1 3 1 2 3 1 3 4 2 2 1 3 2 2 3 3 2 I want to do query to give result like id title 1 MG1 2 MG2 3 Two or More Title MG1 has higher preference if MG1 and count = 1 then it is given as MG1 title , for others corresponding title is used and for count 1 as two or more

    Read the article

  • How to get resultset with stored procedure calls over two linked servers?

    - by räph
    I have problems filling a temporary table with the resultset from a procedure call on a linked server, in which again a procedure on another server is called. I have a Stored Procedure sproc1 with the following code, which calls another procedure sproc2 on a linked server. SET @sqlCommand = 'INSERT INTO #tblTemp ( ModuleID, ParamID) ' + '( SELECT * FROM OPENQUERY(' + @targetServer + ', ' + '''SET FMTONLY OFF; EXEC ' + @targetDB + '.usr.sproc2 ' + @param + ''' ) )' exec ( @sqlCommand ) Now in the called sproc2 I again call a third procedure sproc3 on another linked server, which returns my resultset. SET @sqlCommand = 'EXEC ' + @targetServer +'.database.usr.sproc3 ' + @param exec ( @sqlCommand ) The whole thing doen't work, as I get an SQL error 7391 The operation could not be performed because OLE DB provider "%ls" for linked server "%ls" was unable to begin a distributed transaction. I already checked the hints at this microsoft article, but without success. But maybe, I can change the code in sproc1. Would there be some alternative to the temp table and the open query? Just calling stored procedures from server A to B to C and returning the resultset is working (I do this often in the application). But this special case with the temp table and openquery doesn't work! Or is it just not possible what I am trying to do? The microsft article states: Check the object you refer on the destination server. If it is a view or a stored procedure, or causes an execution of a trigger, check whether it implicitly references another server. If so, the third server is the source of the problem. Run the query directly on the third server. If you cannot run the query directly on the third server, the problem is not actually with the linked server query. Resolve the underlying problem first. Is this my case? PS: I can't avoid the architecture with the three servers.

    Read the article

  • Optimzing TSQL code

    - by adopilot
    My job is the maintain one application which heavy use SQL server (MSSQL2005). Until now middle server stores TSQL codes in XML and send dynamic TSQL queries without using stored procs. As I am able change those XML queries I want to migrate most of my queries to stored procs. Question is folowing: Most of my queries have same Where conditions against one table Sample: Select ..... from .... where .... and (a.vrsta_id = @vrsta_id or @vrsta_id = 0) and (a.podvrsta_id = @podvrsta_id or @podvrsta_id = 0) and (a.podgrupa_2 = @podgrupa2_id or @podgrupa2_id = 0) and ( (a.id in (select art_id from osobina_veze where podosobina_id in (select ado from dbo.fn_ado_param_int(@podosobina)) group by art_id having count(art_id)= @podosobina_count )) or ('0' = @podosobina) ) They also have same where conditions on other table. How I should organize my code ? What is proper way ? Should I make table valued function that I will use in all queries or use #Temp tables and simple inner join my query to that each time when proc executing? or use #temp filed by table valued function ? or leave all queries with this large where clause and hope that index is going to do their jobs. or use WITH(statement)

    Read the article

  • schema for storing different varchar fields over time?

    - by Henry
    This app I'm working on needs to store some meta data fields about an entity. The problem is that we can already foresee that these fields are going to change a lot in the future. I'm using Hibernate (in ColdFusion) and each entity's properties are translated to one column in the entity table, but altering table columns later down the raod will be costly and error-prone right? Should I go for something like this? MetaDataField ----- metaDataFieldID (PK), name FieldValue ---------- EntityID (PK, FK), metaDataFieldID (PK, FK), value [varchar(255)] Is this common? Anything to watch out for? p.s. I also thought of using XML on SQL Server 05+. After talking to some ppl, seems like it is not a viable solution 'cause it will be too slow for doing certain query for reporting purposes.

    Read the article

  • Stored Procedure for Multi-Table Insert Error: Cannot Insert the Value Null into Column

    - by SidC
    Good Evening All, I've created the following stored procedure: CREATE PROCEDURE AddQuote -- Add the parameters for the stored procedure here AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; Declare @CompanyName nvarchar(50), @Addr nvarchar(50), @City nvarchar(50), @State nvarchar(2), @Zip nvarchar(5), @NeedDate datetime, @PartNumber float, @Qty int -- Insert statements for procedure here Insert into dbo.Customers (CompanyName, Address, City, State, ZipCode) Values (@CompanyName, @Addr, @City, @State, @Zip) Insert into dbo.Orders (NeedbyDate) Values(@NeedDate) Insert into dbo.OrderDetail (fkPartNumber,Qty) Values (@PartNumber,@Qty) END GO When I execute AddQuote, I receive an error stating: Msg 515, Level 16, State 2, Procedure AddQuote, Line 31 Cannot insert the value NULL into column 'ID', table 'Diel_inventory.dbo.OrderDetail'; column does not allow nulls. INSERT fails. The statement has been terminated. I understand that I've set Qty field to not allow nulls and want to continue doing so. However, are there other syntax changes I should make to ensure that this sproc works correctly? Thanks, Sid

    Read the article

  • t-sql recursive query

    - by stackoverflowuser
    Based on an existing table I used CTE recursive query to come up with following data. But failing to apply it a level further. Data is as below id name parentid -------------------------- 1 project 0 2 structure 1 3 path_1 2 4 path_2 2 5 path_3 2 6 path_4 3 7 path_5 4 8 path_6 5 I want to recursively form full paths from the above data. Means the recursion will give the following output. FullPaths ------------- Project Project\Structure Project\Structure\Path_1 Project\Structure\Path_2 Project\Structure\Path_3 Project\Structure\Path_1\path_4 Project\Structure\Path_2\path_5 Project\Structure\Path_3\path_6 Thanks

    Read the article

  • Pointer incrementing query

    - by Craig
    I have been looking at this piece of code, and it is not doing what I expect. I have 3 globals. int x, y, *pointer, z; Inside of main I declare them. x = 10; y = 25; pointer = &x; now at this point &x is 0x004A144 &y is 0x004A138 pointer is pointing to 0x004A144 Now when I increment: y = *++pointer; it points to 0x004A148, this is the address y should be at shouldn't it? The idea is that incrementing the pointer to 'x' should increment it to point at y, but it doesn't seem to want to declare them in in order like I expect. If this a VS2005 / 2008 problem? Or maybe an Express problem? This isn't really homework, as I have done it a couple of years ago but I was revising on my pointer stuff and I tried this again. But this time I am getting unexpected results. Does anyone have opinions on this? *UPDATE sorry should be more clear, 'thought' on declaration 'y' should be at 148, and that incrementing the pointer pointing to x should increment 'pointer' to 148 (which it does), but that isn't where y is. Why isn't y declaring where it should be.

    Read the article

  • when i download file from my website which contains grid and in one of the column of grid there is d

    - by SmartDev
    Hi, I have page called filedownload.aspx , it contains grid and in grid they are three columns and in one of the column there is button which says Download , when user clicks on that button it picks file id and gives the download box to user with three options Open save and cancel . Now the problem is that when user clicks on the download button in grid it gives this ERROR: INTERNET EXPLORER CANNOT DOWNLOAD FILEDOWNLOAD.ASPX FROM ABC.XYZ.COM (MY URL EXAMPLE) INTERNET EXPLORER WAS NOT ABLE TO OPEN THIS SITE .THE REQUEST SITE IS EITHER UNAVAILABLE OR CANNOT BE FOUND . ONE MORE THING IS THT RECENTLY WE IMPLEMENTED SSL AND FROM HTTP WE MOVE TO HTTPS WITH NAME CHANGE IN URL ALSO BFEORE IT WAS AND NOW ITS . NOW WHEN I CHANGE THE URL TO OLD ONE THE PAGE IS WORKING FINE . CAN ANYONE HELP ME ON THIS ? THANKS, SMARTDEV

    Read the article

  • Strange Values in SYS.DM_TRAN_LOCKS table RESOURCE_ASSOCIATED_ENTITY_ID column

    - by AJM
    I’ve been trying to understand some strange values in the RESOURCE_ASSOCIATED_ENTITY_ID column of SYS.DM_TRAN_LOCKS when RESOURCE_TYPE is “OBJECT”. Although these should be object Ids, I cannot determine what object they actually refer to. I’ve tried everything I can think of, including querying all system tables with columns of type INT and BIGINT to see if I can find the value. No luck. The funny values actually appear in SYS.DM_TRAN_LOCKS, SYS.SYSLOCKINFO and SP_LOCK.

    Read the article

  • Different execution plan for similar queries

    - by Graham Clements
    I am running two very similar update queries but for a reason unknown to me they are using completely different execution plans. Normally this wouldn't be a problem but they are both updating exactly the same amount of rows but one is using an execution plan that is far inferior to the other, 4 secs vs 2 mins, when scaled up this is causing me a massive problem. The only difference between the two queries is one is using the column CLI and the other DLI. These columns are exactly the same datatype, and are both indexed exactly the same, but for the DLI query execution plan, the index is not used. Any help as to why this is happening is much appreciated. -- Query 1 UPDATE a SET DestKey = ( SELECT TOP 1 b.PrefixKey FROM refPrefixDetail AS b WHERE a.DLI LIKE b.Prefix + '%' ORDER BY len(b.Prefix) DESC ) FROM CallData AS a -- Query 2 UPDATE a SET DestKey = ( SELECT TOP 1 b.PrefixKey FROM refPrefixDetail b WHERE a.CLI LIKE b.Prefix + '%' ORDER BY len(b.Prefix) DESC ) FROM CallData AS a

    Read the article

  • how to change windowXP theme using vb.net2005

    - by Darshna Raghani
    I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport("UxTheme.DLL", BestFitMapping:=False, CallingConvention:=CallingConvention.Winapi, CharSet:=CharSet.Unicode, EntryPoint:="#65")> _ Shared Function SetSystemVisualStyle(ByVal pszFilename As String, ByVal pszColor As String, ByVal pszSize As String, ByVal dwReserved As Integer) As Integer End Function Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'This code will set Window Themes SetSystemVisualStyle("C:\WINDOWS\Resources\Themes\HmmXP_2_0_1\HmmXP\HmmXP.msstyles", "NormalColor", "NormalSize", 0) End Sub Can anyone plz help?

    Read the article

  • SQL Server search filter and order by performance issues

    - by John Leidegren
    We have a table value function that returns a list of people you may access, and we have a relation between a search and a person called search result. What we want to do is that wan't to select all people from the search and present them. The query looks like this SELECT qm.PersonID, p.FullName FROM QueryMembership qm INNER JOIN dbo.GetPersonAccess(1) ON GetPersonAccess.PersonID = qm.PersonID INNER JOIN Person p ON p.PersonID = qm.PersonID WHERE qm.QueryID = 1234 There are only 25 rows with QueryID=1234 but there are almost 5 million rows total in the QueryMembership table. The person table has about 40K people in it. QueryID is not a PK, but it is an index. The query plan tells me 97% of the total cost is spent doing "Key Lookup" witht the seek predicate. QueryMembershipID = Scalar Operator (QueryMembership.QueryMembershipID as QM.QueryMembershipID) Why is the PK in there when it's not used in the query at all? and why is it taking so long time? The number of people total 25, with the index, this should be a table scan for all the QueryMembership rows that have QueryID=1234 and then a JOIN on the 25 people that exists in the table value function. Which btw only have to be evaluated once and completes in less than 1 second.

    Read the article

  • SQL Server Express performance issue

    - by Developer IT
    Hi folks ! I know my questions will sound silly and probably nobody will have perfect answer but since I am in a complete dead-end with the situation it will make me feel better to post it here. So... I have a SQL Server Express database that's 500 Mb. It contains 5 tables and maybe 30 stored procedure. This database is use to store articles and is use for the Developer It web site. Normally the web pages load quickly, let's say 2 ou 3 sec. BUT, sqlserver process uses 100% of the processor for those 2 or 3 sec. I try to find which stored procedure was the problem and I could not find one. It seems like every read into the table dans contains the articles (there are about 155,000 of them and 20 or so gets added every 15 minutes). I added few index but without luck... It is because the table is full text indexed ? Should I have order with the primary key instead of date ? I never had any problems with ordering by dates.... Should I use dynamic SQL ? Should I add the primary key into the url of the articles ? Should I use mutiple indexes for seperate columns or one big index ? I you want more details or code bits, just ask for it. Basicly, every little hint is much apreciated. Thanks.

    Read the article

  • What is happening in this T-SQL code? (Concatenting the results of a SELECT statement)

    - by Ben McCormack
    I'm just starting to learn T-SQL and could use some help in understanding what's going on in a particular block of code. I modified some code in an answer I received in a previous question, and here is the code in question: DECLARE @column_list AS varchar(max) SELECT @column_list = COALESCE(@column_list, ',') + 'SUM(Case When Sku2=' + CONVERT(varchar, Sku2) + ' Then Quantity Else 0 End) As [' + CONVERT(varchar, Sku2) + ' - ' + Convert(varchar,Description) +'],' FROM OrderDetailDeliveryReview Inner Join InvMast on SKU2 = SKU and LocationTypeID=4 GROUP BY Sku2 , Description ORDER BY Sku2 Set @column_list = Left(@column_list,Len(@column_list)-1) Select @column_list ---------------------------------------- 1 row is returned: ,SUM(Case When Sku2=157 Then Quantity Else 0 End) As [157 -..., SUM(Case ... The T-SQL code does exactly what I want, which is to make a single result based on the results of a query, which will then be used in another query. However, I can't figure out how the SELECT @column_list =... statement is putting multiple values into a single string of characters by being inside a SELECT statement. Without the assignment to @column_list, the SELECT statement would simply return multiple rows. How is it that by having the variable within the SELECT statement that the results get "flattened" down into one value? How should I read this T-SQL to properly understand what's going on?

    Read the article

< Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >