Using Stored Procedure into Select (T-SQL)
Hi, I need to access result of a stored procedure withinf a select statement (ie : SELECT * FROM [dbo].[sp_sample]) in SQL_Server 2005. Regards, Stéphane ...
Hi, I need to access result of a stored procedure withinf a select statement (ie : SELECT * FROM [dbo].[sp_sample]) in SQL_Server 2005. Regards, Stéphane ...
Is it possible to use the SQL BEGIN TRANSACTION, COMMIT TRANSACTION, ROLLBACK TRANSACTION when embedding SQL Queries into an application with mutiple calls to the SQL for Table Updates. For example I have the following code: Q.SQL.ADD(<UPDATE A RECORD>); Q.ExecSQL; Q.Close; Q.SQL.Clear; Q.SQL.ADD(<Select Some Data>); Q.Open; Set Som...
We have a project coming up where we will be building a whole backend CMS system that will power our entire extranet and intranet with one package. The question I have been trying to find an answer to is which is better: storing images in the database (SQL Server 2005) so we may have integrity, single replication plan, etc OR storing on ...
I'm trying to create a set of tables where we don't actually delete them, but rather we set the archive flags instead. When we delete an entity, it shouldn't be deleted, it should be marked as archived instead. What are the programming patterns to support this? I would also prefer not to have to roll out my own stored procs for every t...
In SQL Server 2005, why does: PRINT Cast('' AS datetime) display: Jan 1 1900 12:00AM I would have thought it should be null? ...
If I run a package from the Management Studio, and specify a configuration file, everything works as expected. I can also set the package to get it's config path from an environment variable, and that approach works as well. However, if I try and run the package from the command prompt with DTExec I get the error: Cannot load the X...
Occasionally I run into this limitation using SQL Server 2000 that a row size can not exceed 8K bytes. SQL Server 2000 isn't really state of the art, but it's still in production code and because some tables are denormalized that's a problem. However, this seems to be a non issue with SQL Server 2005. At least, it won't complain that ro...
I'm rather new to coding so I'm sure this is fairly easy, but I have not been able to figure this out. I'm building a report in reporting serivces, sql 2005. I have 4 tables: people, event log, program enrollment and program info. I have clients that could be enrolled in numerous programs. I need to be able to find a client's first enrol...
Is there a way to identify the timestamp when an object(table/view/stored proc...) was modified ? there's a refdate in sysobjects but it's always the same as crdate atleast in my case and i know that alter view/alter table/alter proc commands have been run many times post creation ...
Hi. I'm trying to implement SQLServer 2005 with mirror in two W2003 Servers. The application we use doesn't seem to work well with the SQLNCLI driver. When I execute a procedure that should return an XML result, I get something that looks like a binary/columned result. However, with the old connection string (not supporting mirroring), i...
Consider the following Transact sql. DECLARE @table TABLE(val VARCHAR(255) NULL) INSERT INTO @table (val) VALUES('a') INSERT INTO @table (val) VALUES('b') INSERT INTO @table (val) VALUES('c') INSERT INTO @table (val) VALUES('d') INSERT INTO @table (val) VALUES(NULL) select val from @table where val not in ('a') I would expect this...
A co-worker posed this question to me, and I told them, "No, you'll need to write a sproc for that". But I thought I'd give them a chance and put this out to the community. Essentially, they have a table with keys mapping to multiple values. For a report, they want to aggregate on the key and "mash" all of the values into a single fie...
Hi, I have a table which have 6 million recods,when a fire select query with where condition in that table it is timing out. How can I make it run, Please help ...
Hi, I have a web application in which I have a page named 'Data'. Many people will try to insert data into the table at a given time. So the reference no other than the primary key will get duplicated which should not be permitted. For inserting the data into the DB table, I am using a stored procedure in SQL. In my vb.net web applicati...
How can I connect to a principal database when a failover occurs in SQL server 2005 using TSQL.....after failover a pricipal database becomes mirror but still how can i connect to the new pricipal using SQL command ...
What is the correct pattern for doing an atomic "UPSERT" (UPDATE where exists, INSERT otherwise) in SQL Server 2005? I see a lot of code on SO (e.g. see http://stackoverflow.com/questions/639854/tsql-check-if-a-row-exists-otherwise-insert) with the following two-part pattern: UPDATE ... FROM ... WHERE <condition> -- race condition risk...
Hi everybody! In a winforms application i 'm storing one Wingdings char in a SQL Server 2005 field of type NVARCHAR(1). Storing, retrieving and showing up this char in a control works fine. The problem i'm facing is this: how to search for records which have a specific wingding char value: for example Select * from table where FieldW...
I have variable @count of datatype int.I am setting values to this @count. I want to select top @count number of rows from table. When i use Select top @count, its showing error. IF (@NewItemCount<@OldItemCount) BEGIN set @count=@OldItemCount-@NewItemCount if(@count>0) BEGIN Delete from ItemDeta...
Is there a quick and easy way of telling if a table has changed in SQL Server? (I'm using SQL Server 2005). Something like an incrementing ID somewhere that updates on each INSERT, DELETE or UPDATE that I can keep track of. I noticed there is a sys.objects.modify_date column for each table, but I don't think it's quite what I want becaus...
Hi, I'm trying to create a table on a Microsoft SQL Server 2005 (Express). When i run this query USE [QSWeb] GO /****** Object: Table [dbo].[QSW_RFQ_Log] Script Date: 03/26/2010 08:30:29 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[QSW_RFQ_Log]( [RFQ_ID] [int] NOT NULL...