sql-server

Suppress transaction in stored procedure

Hi all, I want to know wether or not it is possible to suppress a transaction inside a SQL stored procedure. I have the following situation in my SP (that I want to achieve): WHILE TRUE BEGIN TRY BEGIN TRANSACTION A RECEIVE MESSAGE FROM SSB QUEUE WITH TIMEOUT BEGIN SUPPRESS TRANSACTION WHILE RECORD IN TABLE ...

getting a property associate with the result of an aggregate function

I have a table used to store array elements, this elements belong to a frame, each element have a date and a comment (among other elements). Something like this: MASTER_FRAME(K) ARRAY_ID(K) ARRAY_INDX(K) DATE COMMENT 1 1 1 27-08-2010 'List 1 Newer' 1 1 2 27-0...

Using CONTAINS from HQL / Criteria API

Hi all, I'm using NHibernate 2.1.2.4000GA. I'm trying to use SQL Server's CONTAINS function from within HQL and the criteria APIs. This works fine in HQL: CONTAINS(:value) However, I need to qualify the table in question. This works fine: CONTAINS(table.Column, :value) However, I need to search across all indexed columns in my tab...

Deadlock issue in SQL Server 2008 R2 (.Net 2.0 Application)

The Sql Server 2008 R2 instance in question is a heavy load OLTP production server. The deadlock issue came up a few days back and is still unresolved. We received the Xml deadlock report that listed the stored procedures involved in the deadlock and some other details. I'll try to list down the facts from this xml first: Two stored pro...

what is the execute statement for select command in SQL?

Hello, In SQL server query analyzer, for executing stored procedure we use exec/execute command followed by name of the proc. In the same way what is the command line/execute statement for ‘select’ command. How this is handled internally by query analyzer. Thanks in advance, Pradeep ...

Inserting value from one table into another in SQL Server

I want to insert value of primary key of a table to the foreign key in another table in SQL Server. Please help me out.. ...

Is there anything faster than SqlDataReader in .NET?

I need to load one column of strings from table on SqlServer into Array in memory using C#. Is there a faster way than open SqlDataReader and loop through it. Table is large and time is critical. EDIT I am trying to build .dll and use it on server for some operations on database. But it is to slow for now. If this is fastest than I have...

Sql query - how to get when a row first got a certain value

Hi, I have a table with rows like this: ID StatusId Date 1 1 2001-01-01 2 1 2001-01-02 3 2 2001-01-03 4 3 2001-01-04 5 1 2001-01-05 6 2 2001-01-06 7 2 2001-01-07 8 1 2001-01-08 9 1 2001-01-09 I need to g...

Calling a stored proc that returns a recordset from within a stored proc

Working in SQL Server 2005, I have a stored procedure that inserts a record and returns the new ID via SELECT @@IDENTITY; as the last command. I then want to call this from another stored proc, and get the value of the new ID. But I can't work out how to get the value returned from the first procedure. Example: CREATE PROCEDURE spMyI...

What's the fastest way to perform SQL functions (select, insert, update) in VBA on an SQL server database?

I don't know between ADO, DAO and DLookUps and such. Does anyone know? ...

SQL Reporting Server Authentication Issue

I have one web server & one DB server (running SQL SERVER 2008). Both the servers are in different domains. The web server is allowed to communicate(the communication takes place internally without the intervention of firewall) directly with the DB server, it is given Admin privileges & the DB access through SQL is going on without any p...

invalid object name 'VchReceipt'

hello all, what is solution of this... Invalid object name 'VchReceipt'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Invalid ob...

how to insert values from one table to another using radio button control

I have created two tables in a SQL Server database and a RadioButtonList in an ASP.NET page. In one table I have stored values for each radio button as primary key. I want that on clicking that radio button, its primary key value in stored another table in a foreign key column. help out....... ...

save user profile image to database

How can I dynamically insert images when user uploads an image file to SQL Server 2005 with C# in ASP.NET? This is to let users upload their profile photos in my web app. Is it very different from how it is done for windows app with C#? ...

SQL query: self-referencing foreign key relationship

I have two tables, tabSparePart and tabSparePartCategory. Every spare part belongs to a spare part category. I need all spare parts that belong to a specific category. But the problem is that a spare part category could be a "subcategory" of another, they reference each other (the "main categories" have 'null' in this FK column). Let's...

Linked server (read data from pgsql and insert it into SQL Server)

I have a SQL Server 2005. I have created a linked server to PG SQL server. It works great. SELECT * FROM OpenQuery(POSTGRESQL_SERV, 'SELECT comp_id,comp_name FROM company WHERE comp_type = 5') I need to read all data from PG SQL and insert it into SQL Server. How to create a while ? (also unique id`s) Thx. ...

sql server stock quote every second

I have a table with stock quotes Symbol Ask Bid QuoteDateTime Using SQL Server 2008, lets say for any given 60 second time period I want to select quotes on all symbols so that there is a record for every second in that time period. Problem is not every symbol has the same number of quotes - so there are some seconds that have no quo...

SQL query to get full hierarchy path

Hi, I have a table with three columns NodeId, ParentNodeId, NodeName. for each node I would like to get a full path like "lvl1/lvl2/lvl3..." where lvl1,lvl2 and lvl3 are node names. I found a function which does that at this link http://www.sql-server-helper.com/functions/get-tree-path.aspx. but I would like to use CTE OR any other techn...

SQL Trigger not working correctly

here are the 2 tables i have, i want to implement an trigger that customer cannot have more than 5 accounts from a one bank, but can have more than 5 in total. CREATE TABLE ACCOUNT( ACCOUNT_NO VARCHAR(20) NOT NULL, BALANCE REAL, BANK_CODE VARCHAR(20), BRANCH_NO VARCHAR(25), ACCOUNT_CODE VARCHAR(20), PRIMARY KEY(ACCO...

SQL Server 2005: Index bigger than data stored

I created 1 database with 2 file groups: 1 primary and 1 index. Primary file group includes 1 data file (*.mdf): store all tables Index file group includes 1 index file (*.ndf): store all indexes Most of indexes are non-clustered indexes After a short time using the database, the data file is 2GB but the index file is 12 GB. I do no...