sql-server

Subquery returned more than 1 value. on MS SQL 2005 trigger.

Hi, I am not so experienced on databases, so bare with me. ;-) A quite simple FOR INSERT trigger keeps returning the error "Subquery returned more than 1 value.." when inserting more than one row at a time. When i insert rows into the table SOA.dbo.photos_TEST using a statement like; INSERT INTO SOA.dbo.photos_TEST (id,length,picture,...

How to keep fuzzy lookup index always in memory using SSIS

is it possible to keep fuzzy lookup index always in memory even after SSIS package has finished with execution? point here is, if it can be done then, when we call again same SSIS package, we don’t have any warm-up time because index is already in memory so we have better performance. We have seen that when we call out SSIS package ind...

sql-Locks concept in sqlserver

I need to know about the lock concept in sqlserver why it is used ? and with any example .is there any pdf or ppt pls specify that ...

Parent Child relation - Sql query

My source is as follows OSPID OSPNAME RELATEDOSPID 100004 LEVEL4 100003 100003 LEVEL3 100002 100002 LEVEL2 100001 100001 LEVEL1 0 100009 LEVEL4 100008 100008 LEVEL2 100007 I need the result as L4OSPID L4OSPNAME L3RELATEDID L3OSPNAME L2RELATEDID L2OSPNAME L1RELATEDID L2OSPNAME ROOTNODE 100004 LEVEL4 100...

How to Prevent Sql Server Jobs to Run simultaneously

I have some jobs for example : job1, executing every 2 minutes job2, executing every 10 minutes job3, executing every 15 minutes now there is a problem. jobs may occur simultaneously and cpu usage go to 100%; is there a solution? remind that I need jobs to run approximately in their appropriate period. thanks. ...

Subquery returned more than 1 value. This is not permit error in AFTER INSERT,UPDATE trigger

Hi, Once again.. i have the trigger below which has the function to keep/set the value in column esb for maximum 1 row to value 0 (in each row the value cycles from Q->0->R->1) When i insert more than 1 row the trigger fails with an "Subquery returned more than 1 value. This is not permitted when the subquery follows" error on row 38, t...

SQL Server Transaction logs full, how to empty and delete them

My transaction log file is full, i have 5 log files , 2 in D: drive & 3 in E: drive. all the log file is full, each log file is 10GB in size. I need to delete all 5 transaction log file and need to have one fresh truncation log file i have tried method, 1. converted from Full to simple and shrik files (but not great effect , it does n...

MS SQL - Is using geometry data type to find distance significantly faster?

Hi guys, I have a database which contains a lot of geospatial data ... basically information on 10s of thousands of people, with coordinates for each of them. The coordinates are currently stored as two floats for latitude and longitude, and I use a function to determine the distance between the coordinates in that record and a coord...

Add Column on SQL Server on Specific Place?

Hello. I would like to know if there's a way to add a column to an SQL Server table after it's created and in a specific position?? Thanks. ...

Selecting nvarchar 'like' in a left join - inner join combination

I currently have a query that returns results based on a dynamic set of conditions DataTable Items: ID Title 1 Some title 2 Some other title ..etc.. . DataTable Tags: ID Tag 1 'a1c' 1 'a1d' 2 'a2c' ..etc.. My current search Query: select * from dbo.Items i LEFT JOIN dbo.tags t on i.ID...

Bugs arised in IE7

I have to retrieve data to the gridview with this query.. string strSelectQuery = "SELECT REPLACE(TITLE, '\n', '<br />') TITLE, REPLACE(DESCRIPTION, '\n', '<br />') DESCRIPTION, " + "ANSWER, FK_OWNER_ID, CREATED_ON FROM M_QA WHERE PK_ID = " + intQuestionId + " AND ...

Single conversation in Service Broker

Hi guys! I'm going to do async auditing on my SQL Server 2008 as shown here: http://auoracle.blogspot.com/2010/02/service-broker-master-audit-database.html What it does is: a trigger sends a message to a queue in the service broker another SP in other database receives the messages and process them The possible problem I see is tha...

Last modification date for a live SQL Server 2005 database

Is there a way to know when the last write operation has occurred in a live SQL Server 2005 database? I currently have 30 (and growing) databases on my server. Only some of these see daily activity (but which ones get daily activity varies over time.) My backup space is limited and I'd like to do a daily backup of all "modified since la...

sql server driver name

Hi, How do I find what string is to be put in my ASP.NET application config file in the 'driver' attribute for the dataAccess node? So here is the node to be clear: <add name="somenamehere" driver="I want to know what goes in here???" connectionStringName="somenamehere"/> Its a MS SQL Server 2008. I am sorry if this has been answered...

How can InstallShield check if SQL Server 2005 (3.1) Compact Edition (CE) is installed

I am developing a Windows desktop application which requires the SQL Server 2005 Compact Edition (SQLServerCE31-EN.msi) to be installed. I am using InstallShield 2011 to install this as a pre-requisite during the installation process. In order to come up with the pre-requisite definition I used Process Monitor to see that these registry...

How to make my SQL Server Management Studio accept a .sql file

I have a .sql file I need to enter in to my database, but I can't find how to do it. I'm using SQL Server Management Studio R2, but haven't found any options on how to add it. When I try to attach it, I'm told that this file isn't a primary database file, so I can't do it... EDIT: okay, I had the script execute. That worked. ...

How to get sql query result into a text file with a specific file name like name_dd-mm-yyyy.txt.

Hello Everyone, Please suggest me how to get sql query result into a text file with a specific file name with current date like name_dd-mm-yyyy.txt.I want do this automatically using a job or Stored Procedure. ...

Invalid susername_sname()/SYSTEM_USER returned after AD login creditentials were changed.

We are using suser_sname() and SYSTEM_USER to return the user name (via trust connection). Within the past month, someone's login name was changed in Active Directory. However these 2 functions are still returning the old login name. The individual has rebooted their PC several times since the change. I'm not sure if the servers were r...

Why/when/how is whole clustered index scan chosen rather than full table scan?

IMO, please correct me... the leaf of clustered index contains the real table row, so full clustered index, with intermediate leaves, contain much more data than the full table(?) Why/when/how is ever whole clustered index scan chosen over the full table scan? How is clustered index on CUSTOMER_ID column used in SELECT query which ...

Is there a reason to use Base2 lengths for columns in SQL Server?

Possible Duplicates: varchar Fields - Is a Power of Two More Efficient? Nvarchar or varchar what is better use multiply of 2 or rounded full numbers?? Out of sheer habit I define the sizes of columns that I use in SQL Server to be Base2 sizes. For example, here's a table that I'm working on: ID int FirstName nvarchar(64) L...