Search Results

Search found 37012 results on 1481 pages for 'sql query'.

Page 111/1481 | < Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >

  • SQL Server cluster install issue

    - by George2
    Hello everyone, I am going to install SQL Server 2008 Enterprise cluster on Windows Server 2008. I am wondering whether I have to setup a Windows domain (or active directory) in order to install SQL Server cluster? thanks in advance, George

    Read the article

  • Store a byte[] stored in a SQL XML parameter to a varbinary(MAX) field in SQL Server 2005. Can it be

    - by Mikey John
    Store a byte[] stored in a SQL XML parameter to a varbinary(MAX) field in SQL Server 2005. Can it be done ? Here's my stored procedure: set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[AddPerson] @Data AS XML AS INSERT INTO Persons (name,image_binary) SELECT rowWals.value('./@Name', 'varchar(64)') AS [Name], rowWals.value('./@ImageBinary', 'varbinary(MAX)') AS [ImageBinary] FROM @Data.nodes ('/Data/Names') as b(rowVals) SELECT SCOPE_IDENTITY() AS Id In my schema Name is of type String and ImageBinary is o type byte[].

    Read the article

  • Cannot delete from sys.tables

    - by Shimmy
    How can I perform this query on whatever way: delete from sys.tables where is_ms_shipped = 0 What happened is, I executed a very large query and I forgot to put USE directive on top of it, now I got a zillion tables on my master db, and don't want to delete them one by one. UPDATE: It's a brand new database, so I don't have to care about any previous data, the final result I want to achieve is to reset the master db to factory shipping.

    Read the article

  • Getting Null value Of variable in sql server

    - by Neo
    Strange situation In a trigger i assign a column value to variable but gives exception while inserting into other table using that variable. e.g select @srNO=A.SrNo from A where id=123; insert into B (SRNO) values (@srNo) // here it gives null I run above select query in query pane it works fine but in trigger it gives me null any suggestions

    Read the article

  • help translate this week query from Oracle PL/SQL to SQL Server 2008

    - by Sarah Vessels
    I have the following query that runs in my Oracle database and I want to have the equivalent for a SQL Server 2008 database: SELECT TRUNC( /* Midnight Sunday */ NEXT_DAY(SYSDATE, 'SUN') - (7*LEVEL) ) AS week_start, TRUNC( /* 23:59:59 Saturday */ NEXT_DAY(NEXT_DAY(SYSDATE, 'SUN') - (7*LEVEL), 'SAT') + 1 ) - (1/(60*24)) + (59/(60*60*24)) AS week_end FROM DUAL CONNECT BY LEVEL <= 4 /* Get the past 4 weeks */ What the query does is get the start of the week and the end of the week for the last 4 weeks. It generates data like the following: WEEK_START WEEK_END 2010-03-07 00:00:00 2010-03-13 23:59:59 2010-02-28 00:00:00 2010-03-06 23:59:59 ...

    Read the article

  • What is your most irritating quirk of t-sql

    - by Jude Wood
    I realise this is a bit flippant but it may highlight some 'interesting' features of t-sql. Or just provide some light distraction on a Friday morning... I'm currently torn between t-sql allows three part naming when dropping tables but not when dropping procudures and When using Coalesce to produce a delimited string the presence of a leading delimiter is dependant on whether the delimited string was initialised prior to calling Coalesce I'd be interested to hear yours......

    Read the article

  • How to refactor T-SQL stored procedure encapsulating it's parameters to a class

    - by abatishchev
    On my SQL Server 2008 I have a stored procedure with a large number of parameters. The first part of them is used in every call and parameters from the second part are used rarely. And I can't move the logic to two different stored procedures. Is there a way to encapsulate all this parameters to a class or struct and pass it as a stored procedure parameter? Can I use SQL CLR. Are there other ways?

    Read the article

  • T-SQL For Each Alternative?

    - by davemackey
    I need to take data from one table and import it into another table. In pseudocode, something like this: For Each row in table1 If row.personid is in table2 then update table2.row Else insert row into table2 End If Next What is the best way to do this in T-SQL? As I understand it T-SQL doesn't support For Each..Next, so what alternatives do I have?

    Read the article

  • Summarising (permanently) data in a SQL table

    - by Cylindric
    Geetings, Stackers. I have a huge number of data-points in a SQL table, and I want to summarise them in a way reminiscent of RRD. Assuming a table such as ID | ENTITY_ID | SCORE_DATE | SCORE | SOME_OTHER_DATA ----+-----------+------------+-------+----------------- 1 | A00000001 | 01/01/2010 | 100 | some data 2 | A00000002 | 01/01/2010 | 105 | more data 3 | A00000003 | 01/01/2010 | 104 | various text ... | ......... | .......... | ..... | ... ... | A00009999 | 01/01/2010 | 101 | ... | A00000001 | 02/01/2010 | 104 | ... | A00000002 | 02/01/2010 | 119 | ... | A00000003 | 02/01/2010 | 119 | ... | ......... | .......... | ..... | ... | A00009999 | 02/01/2010 | 101 | arbitrary data ... | ......... | .......... | ..... | ... ... | A00000001 | 01/02/2010 | 104 | ... | A00000002 | 01/02/2010 | 119 | ... | A00000003 | 01/01/2010 | 119 | I want to end up with one record per entity, per month: ID | ENTITY_ID | SCORE_DATE | SCORE | ----+-----------+------------+-------+ ... | A00000001 | 01/01/2010 | 100 | ... | A00000002 | 01/01/2010 | 105 | ... | A00000003 | 01/01/2010 | 104 | ... | A00000001 | 01/02/2010 | 100 | ... | A00000002 | 01/02/2010 | 105 | ... | A00000003 | 01/02/2010 | 104 | (I Don't care about the SOME_OTHER_DATA - I'll pick something - either the first or last record probably.) What's an easy way of doing this on a regular basis, so that anything in the last calendar month is summarised in this way? At the moment my plan is kind of: For each EntityID For each month Find average score for all records in given month Update first record with results of previous step Delete all records that aren't the first I can't think of a neat way of doing it though, that doesn't involve lots of updates and iteration. This can either be done in a SQL Stored Procedure, or it can be incorporated into the .Net app that's generating this data, so the solution doesn't really need to be "one big SQL script", but can be :) (SQL-2005)

    Read the article

  • How to get SQL Profiler to monitor trigger execution

    - by firedfly
    I have a trace setup for SQL Server Profiler to monitor SQL that is executed on a database. I recently discovered that trigger execution is not included in the trace. After looking through available events for a trace, I do not see any that look like they would include trigger execution. Does anyone know how to setup a trace to monitor the execution of triggers?

    Read the article

  • identity specification gap after several operations

    - by Babak.Abad
    I'm using identity specification for a table of sql server 2012. Let we have two Insert and then two Delete operation. After these operation primary key should start from 1, but it will start from 3. I'm worry about this problem causing no place for inserting new item after long time. Does "Sql-server 2012" fill these gaps by itself? If it is possible, please refer me a documentation ( for example from microsoft)

    Read the article

  • SQL server 2005 :Updating one record from 2 identical records

    - by Shyju
    I have 2 records in a table in SQL Server 2005 db which has exactly same data. I want to update one record.Is there anyway to do it?Unfortunately this table does not have an identity column and i cant use a direct update query because both will be updated since data is same.Is there anyway using rowid or something in SQL server 2005 ?

    Read the article

  • SSIS - 'Execute SQL' Task and Record Sets

    - by Mick Walker
    Hi, How can I access a 'RecordSet' within a 'Execute SQL' task when using SSIS? I have looked at the parameter mapping options within the Execute SQL Task Editor and cannot find a type of object to allow me to pass the variable holding my record set to the task.

    Read the article

  • SQL 2005 Merge / concatenate multiple rows to one column

    - by Dave
    Hi, We have a bit of a SQL quandry. Say I have a results that look like this... 61E77D90-D53D-4E2E-A09E-9D6F012EB59C | A 61E77D90-D53D-4E2E-A09E-9D6F012EB59C | B 61E77D90-D53D-4E2E-A09E-9D6F012EB59C | C 61E77D90-D53D-4E2E-A09E-9D6F012EB59C | D 7ce953ca-a55b-4c55-a52c-9d6f012ea903 | E 7ce953ca-a55b-4c55-a52c-9d6f012ea903 | F is there a way I can group these results within SQL to return as 61E77D90-D53D-4E2E-A09E-9D6F012EB59C | A B C D 7ce953ca-a55b-4c55-a52c-9d6f012ea903 | E F Any ideas people? Many thanks Dave

    Read the article

  • How can I programmatically drop a SQL Server database from .NET code

    - by Craig Shearer
    I'm trying to drop a SQL Server database from .NET code. I've tried using the SMO classes but get an exception saying the database is in use. Then I tried executing a query (opening a SqlConnection, executing a SqlCommand), along the lines of: ALTER DATABASE foo SET SINGLE_USER WITH ROLLBACK IMMEDIATE (pause) DROP DATABASE foo But still I get an exception saying the database is in use. How do I do this? (Or, how does SQL Server Management Studio implement the Drop database and close existing connections?)

    Read the article

  • SQL optimization: deletes taking a long time

    - by Will
    I have an Oracle SQL query as part of a stored proc: DELETE FROM item i WHERE NOT EXISTS (SELECT 1 FROM item_queue q WHERE q.n=i.n) AND NOT EXISTS (SELECT 1 FROM tool_queue t WHERE t.n=i.n); A bit about the tables: item contains about 10k rows with an index on the n column item_queue contains about 1mil rows also with index on n column tool_queue contains about 5mil rows indexed as well I am wondering if the query/subqueries can be optimized somehow to make them run faster, I thought that deletes were generally fairly fast

    Read the article

  • Unique id of a column

    - by Kayes
    Hi. Does each column of a table in SQL Server have a unique id? I've looked into sys.columns and the column_id there is merely the order of the columns which changes if the order of the column is changed. I'd like to know if SQL Server maintains a unique id for each column as it does for each table and other objects. And if it does, how can I get that? Thanks.

    Read the article

  • Setting the AccountController in ASP.NET MVC 1.0 Template Not to Connect to SQL Server Express

    - by Maxim Z.
    I'm writing a website in ASP.NET MVC, using the ASP.NET MVC 1.0 template that was added to VS2008 for me by the ASP.NET MVC installer. The template automatically adds an AccountController, but its account methods tie into a SQL Server Express entity. I don't have Express installed here. How can I reconfigure it to use my SQL Server 2008 database and to store user info in some columns in a User table I've already created?

    Read the article

< Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >