Archived Months
January 2003
March 2003
April 2003
May 2003
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
April 2008
all groups > sql server programming > september 2006 > threads for tuesday september 12

Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Dynamic SQL and column-values
Posted by Michael Schwab at 9/12/2006 10:06:26 PM
Hi, one question where I can't think of an answer - - imagine I had a variable that accepted simple SQL statements, like @test = 'SELECT col1, col2 FROM table ORDER BY col1' If @test was executed I'd like to loop through the data set and retrieve the value of col2 in the row where col1 is wh...more >>


TSQL array
Posted by mecn at 9/12/2006 5:01:23 PM
Hi, I need to automate a sql job by using t-sql. Here is the code, declare @intcounter int declare @maxcount int declare @intct int declare @RestoreDevice varchar(100) select @RestoreDevice1 ='\\backup2\SqlBackup\GrtPlnDb\LogAppend\AccT_log.bak' select @RestoreDevice2 ='\\backup2\Sql...more >>

Trying to do a blog join (entry columns, and # of comments) without success
Posted by ffrugone NO[at]SPAM gmail.com at 9/12/2006 3:21:17 PM
Like everyone else in the known world, I'm programming my own blog. Only, I'm not figuring out, (like so many others) how to do a single query to get both each of my indiviual blog entries and the count of the number of comments for each of those entries. I am trying to get this output: id ...more >>

How do I.....?
Posted by hecsan07 at 9/12/2006 3:14:02 PM
Hey I am a newbie to SQL programming. I am having difficulties finding repeated records within a recordset. For instance, if the recordset has the following fields, ID, Name, Address. Assume that none of this fields is a key field. How do I query the recordset to find multiple combinations...more >>

Re: Connections List
Posted by mason at 9/12/2006 2:58:39 PM
Another thought. If OLE DB driver does not provide a parameter for applications to submit a program identifier, is it possible to set this information into a system table from an app after the database connection is established? Thanks. "mason" <masonliu@msn.com> wrote in message news:......more >>

Other ways to run this query?
Posted by Ian Boyd at 9/12/2006 2:54:59 PM
/*It's a long post, and it can all be copied and pasted into QA. i have a "TransactionEntries" table, that has multiple entries for a single transaction. Example#1 TransactionID, CurrencyCode, Bought, Sold 1, USCash, 20, 0 1, CanadianCash, 0, 25 In th...more >>

Assign A Flag Value
Posted by Anonymous at 9/12/2006 2:54:02 PM
I have a table as follows: Record1 = LName: Doe FName: John SSN: 555-55-5555 Date: 10/1/2006 Record2 = LName: Doe FName: John SSN: 555-55-5555 Date: 06/15/2006 I would like to loop through all records using the LName, FName, and SSN (not my data so I don't have a unique iden...more >>

validate statement before execute with sp_executesql
Posted by newbie at 9/12/2006 2:53:07 PM
Is there a way to validate or prepare a sql statement built dynamically. By validating it I mean making sure the table and field names are correct, the data types match, but not actually execute it. Ideas, suggestions ... much appreciated. Gigel ...more >>



timeout expired
Posted by Dariusz Tomon at 9/12/2006 2:40:02 PM
Hi I have web application (ASPNET C#) which retrieves data from database (MS SQL Serv 2000). I get timeout expired i one of page (rest works ok). Line 338 is problematic. I know that this problem is from border between ASPNET and SQL but maybe somebody has got an idea? Regards Darius...more >>

Select into existing table
Posted by Michel Racicot at 9/12/2006 2:30:47 PM
I create a temporary table with the same structure as another table by using this statement: select * into ##Inserted from Inserted select * into ' + @Table_Name + ' from ##Inserted drop table ##Inserted However, the second time around, the table named @Table_Name is already existing and...more >>

Cannot Deploy CLR Function...
Posted by Fabio Marreco at 9/12/2006 2:24:58 PM
Hi there.. I´m trying to create a Sql Server User Defined Function on Visual Studio 2005. The Sql Project Builds fine, and my Sql Express Service works as well... But when I try to deploy my project, I get the following error: "Common Language Runtime (CLR) v2.0.50727 not installed prope...more >>

SQL 2005 slower than 2000?
Posted by RobbMichel NO[at]SPAM gmail.com at 9/12/2006 2:18:48 PM
We have an application that initially used SQL 2000. We have a client that insisted on SQL2005. Now when our application runs (for example) a stored procedure (and most other parts of the program) on the SQL2005 database it takes a lot longer than (3 or 5x longer) it does on the same database ...more >>

running a DTS package from an SP
Posted by jaylou at 9/12/2006 1:48:16 PM
I have created an SP that uses xp_cmdshell. When I run this SP, I can't acces the files it is trying to copy. I am an SA on the box so xp_cmdshell should be running from the SQL Server service account. I tried to run this from a non SA account so it would use the SQL Agent proxy account. I ...more >>

Connections List
Posted by mason at 9/12/2006 1:16:04 PM
I understand that I can list current connections using the sys.sysprocesses view in SQL2005; however, the program_name column is often empty. Is there another way to identify client applications? Thanks. ...more >>

SSPI
Posted by CLM at 9/12/2006 11:55:02 AM
I just set up a test case of log shipping on two 2000 servers. Everything seemed to go smoothly, but I noticed that no modifications to the primary database was getting passed to the secondary. So I looked at my log shipping log files and here is the error I got: "Microsoft (R) SQLMaint U...more >>

Dynamic SQL load into dynamic table
Posted by Scott at 9/12/2006 11:42:34 AM
First, I welcome any alternate solutions to this problem, but please, no lectures on proper SQL or how a database works. The problem: I am using SQL Server 2005 Std to gather data from multiple data sources (SQL, Oracle and DB/2) for reporting needs. I have many, many reports that will hi...more >>

Return a City in a column on max count from another column in a group by
Posted by gv at 9/12/2006 11:41:29 AM
Hi all, Trying to return the city that has the most switches in market SELECT SA.A_MARKET, SA.STATE, l7.[sw city], sa.switch FROM A_S..SWIT_REA AS SA INNER JOIN L..[LG 7] AS L7 ON SA.SWITCH = L7.SWITCH ...more >>

Authentication and Auditing: Incorrect username in Audit Tables
Posted by JimLad at 9/12/2006 11:26:55 AM
Hi, I've been tasked with reviewing the Authentication and Auditing of an application and database. ASP/ASP.NET 1.1 app with SQL Server 2000 database. Separate audit trail database on same server. The system is intranet based and currently uses Basic Authentication on IIS6. The appli...more >>

Separate Records Into Multiple Records
Posted by Anonymous at 9/12/2006 11:25:01 AM
I have the following fields currently in a table: LName, FName, SSN, S1Date, S1a, S2Date, S2a, S3Date, S3a Sample data as follows: Record 1 = LName: Doe FName, John SSN: 555-55-5555 S1Date: 1/1/06 S1a: 999999 S2Date: 2/15/06 S2a: 22222 S3Date: S3a: Record 2 = LName: Doe F...more >>

A .NET Framework error occurred during execution of user defined r
Posted by gaharlan at 9/12/2006 11:14:02 AM
The below message is returned on my Development Server. I am running the same version of SQL Server on my local machine Local connection is Windows, Dev Server is SQL Server Auth. The same T-SQL Script ran against local works. Configuration between the two SQL Server Databases should be Identi...more >>

Update Information in SQL from a VBS script
Posted by Matthew at 9/12/2006 10:38:51 AM
I have a vbs script that calls a list of systems inside a SQL database. It then uses that list to go out and collect additional information on those systems and inserts the collected data into another table. My question is what is the best way to remove redundant date. Should I just update t...more >>

Query question
Posted by Lucas Graf at 9/12/2006 10:35:13 AM
DDL Below.. Using that DDL you will end up with a TestCases Table that will have the following data 1 1 13080 Windows XP Card1 Games 1 NO 2 1 13080 Windows XP Card2 Games 1 NO 3 1 13080 Windows 2000 Card1 Games 1 NO 4 1 13080 Windows 2000 Card2 Games 1 NO And a Reports table w...more >>

Converting Orcale DECODE stmt to T-SQL
Posted by Rob at 9/12/2006 9:25:02 AM
Hi, I've been asked to convert some Oracle code to SQL. As I begin my journey, the first stumbling block I've come across is with this Oracle stmt: Select..... decode(ft.from_resv_id,null,''(Group)'',rn.guest_last_name||decode(rn.guest_first_name,null,'''','', ''||rn.guest_first_name)) "Gue...more >>

Setting up the SQL Server alias programatically
Posted by Chris Dunaway at 9/12/2006 9:22:33 AM
In our corporate environment, the data services group, for some reason, does not run SQL Server using it's default ports, they always change. For my application, I have to install the SQL client tools on the machine where the app will be run and then set up an alias to that port. Can this be ...more >>

Need help with select statement
Posted by jdemerath2 NO[at]SPAM new.rr.com at 9/12/2006 8:35:17 AM
I have a SQL database and am having problems with a SELECT statement. I have an application that date and time stamps entries into the database. I am trying to create a SQL statement that will return all records that are like 8/31/2006. I don't want it to look at the time. I am unable to get t...more >>

Matching values within a column
Posted by tom.redfern NO[at]SPAM gmail.com at 9/12/2006 7:48:23 AM
HELLOW!!! I need some help and would be very grateful to whoever can show me the light. I have a table with an ID column and a postcode column. I need to return postcode matches grouped by postcode, from with the same column, and only return the match once. I know I can do this with a curso...more >>

Trasnactions in triggers
Posted by SalamElias at 9/12/2006 7:34:01 AM
If I have a transaction inside a SP in which makes an update on a table that has a trigger for updates In the trigger I have a commit transaction if I do a roolback in the SP does the transaction in the trigger rolls back also in spite it has done he commit Thanks ...more >>

SQL Select using parameter
Posted by nospam NO[at]SPAM meatonconsulting.com at 9/12/2006 7:29:26 AM
I have a rather simple select statement that is driving me mad! Here is what currently works: SELECT EntiyId, Source, LDAP_DN, EntryType, Message, EventTime FROM dbo.ONT_LDAP_LOG WHERE (EntryType = 'Error') AND (CONVERT(varchar(10), EventTime, 101) LIKE '%8/22/2006%') Here...more >>

Trigger
Posted by SalamElias at 9/12/2006 7:21:02 AM
If we have a trigger for INSERT on a table, Does a trigger is launched for each line when I do a Bulk insert in a table or is it launched only once and the inserted tbale contains all lines. Thanks...more >>

Want to display the execution time of a SP
Posted by amit at 9/12/2006 6:47:06 AM
Hi All, I want to capture the total time taken by SQL Server for execution of a Stored Procedure. Please suggest. Thanks in advance. Amit ...more >>

CAST and CONVERT Dates
Posted by wnfisba at 9/12/2006 6:43:01 AM
Could someone suggest a web site where I might go to learn and see syntax regarding the CAST and CONVERT date function within SQL Server??? The SQL Server Books Online seems a little weak in this area so any help would be greatly appreciated. Let me know. Thanks. wnfisba...more >>

SQL 2005 MCDBA Preparation
Posted by Mark at 9/12/2006 6:26:01 AM
I would like to prepare for SQL 2005 certification exam. Can someone please suggest some good books, white papers etc that can help me preparing forit. Thanks in advance. ...more >>

sp4 installation
Posted by bijupg NO[at]SPAM hotmail.com at 9/12/2006 5:54:02 AM
I am having two sql servers SERVER1 as distributor and publisher while SERVER2 as subscriber. which server i have to update sp4 first?or it does'nt matter? pls advice. rgds Biju ...more >>

SQL statement increase question
Posted by Pauljh at 9/12/2006 5:47:51 AM
Hi All, Firstly appologies if this is the wrong group but I couldn't find a comp.lang.sql or any such one similar. My question is probably a simple SQL question for experts among you, but come from a background of most my SQL being SELECT x FROM y I can't fathom how to do it. The prob...more >>

Two instances of sql on one server causes problems
Posted by Vili at 9/12/2006 2:52:55 AM
Hi I have two instances of sql on my server 2000 (a) and 2005(b) How can I make a connectionstring to connect the b when it always connets a. Provider=SQLOLEDB.1;Password=notreal;Persist Security Info=True;User ID=notreal;Initial Catalog=sometable;Data Source=myServer I tried Initial Cat...more >>

Help me performance optimize
Posted by Rasmus Lynggaard at 9/12/2006 2:30:02 AM
Hi all hope you are in for a challenge. I have the following query in a stored procedure. It takes a lot of time to run (hence around 2.5 million records to select from) Can anybody help me optimize this? CREATE PROCEDURE sp_Synergize_GetVariants @Lang char(2) , @kmatnr int AS DECLA...more >>

General question
Posted by Daniel at 9/12/2006 1:53:20 AM
If you need a load of data from a table what is better, to run multiple sql or do it all in one sql and return a large clump in one go and access that? Also what is the syntax for getting a stored procedure to return a variable, is it like this: declare @retVar int set @retVar = (select...more >>

how to query this linkedserver
Posted by Chris at 9/12/2006 1:42:02 AM
Hi, How can I query a linked server like this select * into linkedserver.linkserverdatabase.dbo.testtable from mytable Is this possible? Thanks...more >>

Query question
Posted by Lucas Graf at 9/12/2006 1:18:32 AM
DDL Below.. Using that DDL you will end up with a TestCases Table that will have the following data 1 1 13080 Windows XP Card1 Games 1 NO 2 1 13080 Windows XP Card2 Games 1 NO 3 1 13080 Windows 2000 Card1 Games 1 NO 4 1 13080 Windows 2000 Card2 Games 1 NO And a Reports table with the d...more >>

How to configure the Active Directory users to SQL 2005 Database with selected permissions
Posted by dimensionality at 9/12/2006 12:13:13 AM
Hi All, How to configure the Active Directory users to SQL 2005 Database with selected permissions like Select, Create,Alter etc., Thanks in Adv. Murali ...more >>

Strange result
Posted by simonZ at 9/12/2006 12:00:00 AM
I have something strange happening on SQL2005. I have 2 tables, orders and products. Now, I would like to see, if there is any order with productID and countryID which not exsists in product table. So, I created join: select distinct o.productID, o.id_country from orders o LEFT JOIN produ...more >>

The opposite to DECLARE..
Posted by Man-wai Chang at 9/12/2006 12:00:00 AM
DECLARE instantiates a variable. How could I release a variable? -- .~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org / v \ Simplicity is Beauty! May the Force and Farce be with you! /( _ )\ (Ubuntu 6.06) Linux 2.6.17.13 ^ ^ 19:44:01 up 3 days 38 min 0 users load a...more >>

Tree table
Posted by Andrzej Jaworek at 9/12/2006 12:00:00 AM
Hello, I have a "tree" table: Id - primary key ParrentId - (foreign key) related to Id Title ..... when I delete some record I want to delete it with all childs (cascade deleting). I can't set cascade deleting on the same table :(. Is there any easy way in the MSSQL 2005 to do this ?...more >>

Case order by
Posted by Lasse Edsvik at 9/12/2006 12:00:00 AM
Hello I was wondering if you guys could tell me why i cant use DESC like this in my order by clause. ORDER BY CASE WHEN NOT X0 IS NULL THEN X0 ELSE X0 DESC END /Lasse ...more >>

Search for text in pdf stored in database?
Posted by Mats-Lennart Hansson at 9/12/2006 12:00:00 AM
Hi, I'm sorry if this is the wrong forum, but I don't know where to ask otherwise. I have a SQL Server 2005 database containing a number of pdf:s and doc:s. I want to be able to search for words inside these documents. I'w appreciate any suggestions that would help me to solve this issue!...more >>


DevelopmentNow Blog