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 > may 2006 > threads for tuesday may 23

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 31

Help with Sql Statement Where Like Column Query
Posted by Greg V at 5/23/2006 9:57:01 PM
Hi, I need a bit of help figuring out a sql statement. I have one table filled with static data. (TableEquip) Code Desc ----- ------ T37 Tank T42 Heavy Tank Then I have data that is pulled hourly (TableUsers) User Equip ----- --------- 001 02\T37\W 002 ...more >>


Using Transactions with Aliases
Posted by Darren at 5/23/2006 7:52:01 PM
We currently setup an environment using the Server Alias from the SQL Server Client Network Utility. We are using these connections (which are different servers than the one we configured the alias on) as link servers. When I attempt to run a Store Procedure with BEGIN TRANS trying to get da...more >>

How to get the current User when using a general connection user
Posted by David at 5/23/2006 6:59:03 PM
I have a VB.Net app and a SQL Server 2005 database. Users must login to use the application, and I have an Employee table to store their details. However, I use a common user ID to connect to the database (for reasons I won't go into here). My problem is, some of my triggers need to know wh...more >>

What does not get backed up?
Posted by John Baima at 5/23/2006 6:15:30 PM
I mentioned in an earlier post that I am seeing a large difference in speed between two closely related queries. I'm also seeing a large difference between the production server and my laptop. In general, while the server is somewhat faster than my laptop, it is not that much faster. I'm sure th...more >>

distinct query
Posted by soc at 5/23/2006 5:30:38 PM
Hello, If I have data such as: col1 col2 col3 col4(date) 1 2 3 01/11/2005 1 2 3 02/11/2005 1 2 3 03/11/2005 1 1 2 04/11/2005 1 1 2 05/11/2005 1 1 2 06/11/2005 How can I select so that the results are ...more >>

What is the optimal way to syncronize records between two tables?
Posted by Edgard L. Riba at 5/23/2006 5:26:07 PM
Hi, I have the following scenario. I have the following table CREATE TABLE iTransRow ( idLoc INTEGER NOT NULL, idSeq INTEGER NOT NULL, idLine INTEGER NOT NULL, Item INTEGER NULL, ItemExt ...more >>

How to retrieve name of current database in TSQL query
Posted by Laurence Neville at 5/23/2006 5:22:17 PM
How can I get the name of the current database within a TSQL query (SQL 2000)? There doesn't seem to be an @@variable for it. ...more >>

T-SQL to create a Wealth Index on the fly.
Posted by Jeremy Gollehon at 5/23/2006 4:45:05 PM
I'm hoping someone here can help as I haven't been able to tackle this problem efficiently. I'll try to break the problem down to it's simplest components. I have a MonthYear table, a Performance table, and a Company table. The Performance table has a CompanyKey and for a given month (MonthYe...more >>



Importing data into a view
Posted by Nikhil Patel at 5/23/2006 4:20:21 PM
Hi all, I am trying to import data from dbf files into a sql view using DTS. I see that only buck copy allows me to import data into a view. I can't use this because I need to choose which rows and columns I need to import when I am importing them. What is the easiest way to import data into ...more >>

stored procedures input values
Posted by Tracey at 5/23/2006 3:07:02 PM
Please forgive my wording of this request for help. I have a stored procedure that passes in one value (taskid). At the time you could have only one task for this application, but now it allows you to have many tasks. I am trying to find out if there is a way to pass a series of input tas...more >>

How to access the result of the dynamic sql in sp
Posted by Jen at 5/23/2006 2:57:01 PM
Hi, In my sp I have a dynamic sql as set @qry = 'select v1, v2 from ' + @table + ' where ...' in this sp how can I user v1? I need to check the value of v1. Thanks...more >>

CLR SqlTrigger and Schemas
Posted by developer NO[at]SPAM stf.com at 5/23/2006 2:31:02 PM
I cannot get a Trigger to work on a schema table set that is not dbo. For example with AdventureWorks if I used: <Microsoft.SqlServer.Server.SqlTrigger(Name:="utrigPersonas", Target:="Person.Address", Event:="FOR UPDATE")> When I try to deploy this it returns the error: Cannot find th...more >>

how to select a value into variable in sp
Posted by Jen at 5/23/2006 2:30:02 PM
Hi, In sp can I select a value into a variable? like "select myValue into @myVar", then later I need to compare this value with something else. If can't, I need to a vlaue from prevoius select statement in sp, how can I do it? Thanks...more >>

nvarchar and output to flat file.
Posted by John Smith at 5/23/2006 2:23:14 PM
Hello, Im outputting a sql table to a text file. One of the columns in this table is an nvarchar(1200) but the result in the flat file is truncated to 254 chars.....how do ensure that it outputs all chars up to 1200? thx ...more >>

CmdExec issue
Posted by Lianne Kwock at 5/23/2006 2:14:01 PM
Hello, I have a batch file in the operating system, which runs an osql command that create a stored procedure, a view and a function on a database. It is with -E trust connect. It works when I just run it on windows. However, if I run in as a SQL Job by using the CmdExec, it could not ...more >>

Deprecated features in 2005
Posted by Ata John at 5/23/2006 2:08:02 PM
Hello folks, I am currently working on a project plan to move from SQL7/NT4 to SQL2005/Win2003 and I am putting together a documentation for our developers regarding new features and deprecated features in 2005. Can you point me to a detailed ducumentation on the programming side? Thanks ...more >>

Opinion on SQL Stored Procedure Syntax
Posted by vncntj NO[at]SPAM hotmail.com at 5/23/2006 1:47:49 PM
I'm trying to improve the quality of life of this SP CREATE Procedure p_generatedata @StartDate smalldatetime, @EndDate smalldatetime as Set Nocount on delete ttemp_data Insert into ttemp_data SELECT appeal_codes, appeal_type, appeal_code, SUM(total_yes) AS total_yes, SUM(Pledge_Amou...more >>

order of "RAISERROR" and "ROLLBACK TRANSACTION" in trigger
Posted by V T at 5/23/2006 1:47:23 PM
Hello, SQL manual generally suggests following code: IF (some_check_within_insert_update_delete_trigger) BEGIN RAISERROR (....) ROLLBACK TRANSACTON END My question is if anyody knows why RAISERROR (not ROLLBACK TRANSACTION) goes first ? Is there a particlular reason for that...more >>

Boolean bit field Which is True False
Posted by Michael Miller at 5/23/2006 1:32:02 PM
I have a field that I need to query for true and false. The field is a bit. Is True 0 or 1. I can't open Books Online and the download instructions based on my version SQL 2000, are not clear and I don't know what detailed version I have nor where to find it. -- MichaelM...more >>

Creating a Trigger on Table Access
Posted by iamalex84 NO[at]SPAM gmail.com at 5/23/2006 1:13:51 PM
Hi, I am trying to create a trigger to update a datetime field when a user logs in to their account. Is there a way to create a trigger that updates a field when the table is accessed? The only other possible way I can think of to accomplish this would be to write code that updates a field ...more >>

Tough Question!
Posted by Vai2000 at 5/23/2006 1:02:51 PM
Hi All, I have been given a task to display the schema of a target db (MS SQL) and display its relationship visually on an ASPX Page. How should I proceed with it Any pointers, tips would be highly appreciated. Thanks a lot ...more >>

output to file
Posted by John Smith at 5/23/2006 1:01:32 PM
Hello I want to output a table to file. In a DTS package I can use the text file (destination), but my problem is the delimiter. I only have a couple of options from the drop down list(no custom option). how do I use a custom delimiter. I want to use a "`". thanks ...more >>

Number of columns in a query affects the number of rows returned?
Posted by eric.goforth NO[at]SPAM gmail.com at 5/23/2006 12:30:28 PM
Hello, I have a T-SQL query similar to the following that returns fewer number of rows when I remove columns from the select clause. Any idea why this is? I'm not changing the JOIN clauses when I do this, just the number of columns, for instance I change ------------------------------------...more >>

Having trouble implementing complicated business rules.
Posted by Richard Carpenter at 5/23/2006 11:37:55 AM
The company I work for is a managed healthcare organization. One particular metric we use for determining compensation for a medical practice in our network is tracking the number of times a particular practice sees a particular patient (member of the healthcare network). Practices are awarded o...more >>

Run SSIS from ASP.net
Posted by zino at 5/23/2006 11:25:03 AM
in sql 2005 sp1, when I try to run a package from an asp.net page the following statement generate error: myPackage = integrationServices.LoadFromDtsServer(packagePath, "myServerName", Nothing) error: EXECUTE permission denied on object 'sp_dts_getpackage', database 'msdb', schema 'd...more >>

Does It Matter...
Posted by rmg66 at 5/23/2006 11:18:15 AM
MSSQl 2000 When creating a select statement with joins... does it matter where you = place additional where-clause criteria. Considering the two examples below, is it more efficient to place = additional filtering criteria within the join section.? Does it weed out = extra rows before joini...more >>

BCP Queryout export to XML Question
Posted by Daniel Regalia at 5/23/2006 11:01:01 AM
Hey All, Thought I'd take a break from Scalar Functions for a while and give Omnibuzz a break from answering them. I've searched thru the BOL, and this forum, as well as the help files in SQL2005. I've gotten to the point where I am exporting the data correctly..however I am looking f...more >>

insert into tbl1 select * from tbl2order by field1 doesnt work!
Posted by cooltech77 at 5/23/2006 10:15:33 AM
Hi I am trying to insert records from tbl2 into tbl1 in a sorted order but its not working. insert into tbl1 select * from tbl2order by field1 The records are not being added in a sorted order.can anyone please explain? Thanks for your help ...more >>

how to return truncated field
Posted by samuelberthelot NO[at]SPAM googlemail.com at 5/23/2006 9:56:15 AM
Hi, I'd like to select a field of my table and also a truncated version of that field: SELECT Field1, Field1_truncated FROM myTable This field is of type nvarchar. Field1 should contain the entire string valule whereas Field1_truncated should only contain the first 10 characters of the o...more >>

SQL Qry question
Posted by Kris at 5/23/2006 9:49:37 AM
Hi, In my table I have historical data, Pls see sample. CustId Start$Amt End$Amt SnapShotDt 1 1000 900 2005-01-01 1 890 800 2005-02-01 Now when I am trying to read data for SnapShotDt ='2005-02-01' , I want to replace Start$Amt=8...more >>

adding a counter to a select query?
Posted by KayC at 5/23/2006 9:36:58 AM
I am using SQL Server 2000 v8 Is there a way to add a counter to SELECT statement without writing to tables Ultimately I am trying to get a dataset from a SQL statement split into blocks of 80000 rows ...more >>

USP returning wrong value. Help!!!
Posted by Justin at 5/23/2006 9:00:01 AM
CREATE PROCEDURE usp_Test ( @LoginName VARCHAR(50) = NULL ) AS IF NOT EXISTS (SELECT * FROM tblVendors_EP WHERE Login_Name = @LoginName) RETURN -1 ELSE RETURN -2 GO I have the above usp for the sake of simplicity. When I call EXEC usp_Test @LoginName = NULL (or EXEC usp_Test), ...more >>

CmdExec Jobs
Posted by Mitch at 5/23/2006 8:40:02 AM
Hello - I am trying to set up a job through sql server agent. The job sets the osqluser and osqlpassword, then calls a bunch of batch files. When I run it in dos, it works great, but in the sql job, it does nothing. Does the syntax need to be different or something?? SET uname=Uname SET...more >>

.adp successor front-end to SQL Server 2005
Posted by Lolik at 5/23/2006 8:33:02 AM
If rumours are true that .adp is likely to be phased out in future MS Access versions, what front-end with similar functionality (forms, reports, coding) would you suggest for development and use with MS SQL Server?...more >>

problem creating view on table from linked server DB using IP addr
Posted by Rich at 5/23/2006 8:19:02 AM
Hello, I can create a view on a table from a named linked server database. select * from server1.RemoteDB.dbo.Table1 But I am having a problem creating a view on a table from a non-named linked server that is just using the IP address of the server. Example: Select * from [56.19.175...more >>

Conver String to Date
Posted by Phil at 5/23/2006 7:55:03 AM
Hi all, I am trying to convert the string value of '12.01.50' to a propert date value of 12/01/1950, I have tried various things but cant seem to get it into the right format although I can convert it to a date type. Can anyone help? Thanks Phil...more >>

Slow SP - Is it an index problem
Posted by GeorgeBR at 5/23/2006 7:40:01 AM
I have a stored procedure which builds a memory table by going through a Deals list, selecting each relevant type. For example, INSERT INTO @temptable SELECT [column_list] FROM Deals WHERE Deal_Type = 1 AND Cust_ID = @Cust_ID It does this about five times, choosing the various different de...more >>

Create a New Database that doesn't resemble the model database
Posted by Er at 5/23/2006 7:35:01 AM
I am trying to create a database with none of the user-defined tables contained in the model database. All I need, essentially, is an empty database. Thanks ...more >>

How to Dump Multiple Stored Procedures to Multiple Files?
Posted by samtilden NO[at]SPAM gmail.com at 5/23/2006 6:52:20 AM
I would like to dump each of the stored procedures in one database to a separate file. Programmatically would be great (e.g., start with SELECT * FROM sysobjects WHERE xtype='P'), so that I can have greater flexibility. My last resort is to use some tool already written by somebody else tha...more >>

How to change columns to rows
Posted by Stephen K. Miyasato at 5/23/2006 6:47:07 AM
I have a need to change the columns in a table to rows with values /****** Object: Table [dbo].[Test] Script Date: 5/23/2006 6:39:49 AM ******/ if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Test]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) BEGIN CREATE TA...more >>

cursors problem
Posted by amjad at 5/23/2006 5:41:02 AM
hi i am getting that message to update field value into table Msg 16933, Level 16, State 1, Procedure RmDupValWSWCode, Line 39 The cursor does not include the table being modified or the table is not updatable through the cursor. I have two databases with same tables, in one database it wor...more >>

Stored Procedure running VERY Slow
Posted by Jeries Shahin at 5/23/2006 3:01:01 AM
Hello I have a very severe problem facing me in Microsoft SQL Server 2000. I have a stored procedure, complicated select, but no temp tables, no cursors, only nested selects. The problem is that when running this stored procedure, it may take 30 minutes, sometimes 3 hours. but when taking t...more >>

SQL 2005 MCTS, worth doing?
Posted by CharlesA at 5/23/2006 2:31:01 AM
Hi folks, a little of bit of advice would be greatly appreciated. I've got an MCSD.net with a 70-229 SQL Server elective. I don't really wish to be an MCDBA (it would be great, but would require too much time right now) and I'm reading about the MCTS, this appears to be one exam only. ...more >>

conventions about namereferences
Posted by googleRon at 5/23/2006 1:50:01 AM
Hallo, Can someone tell me the difference between pcd_mn..nslAfdeling and pcd_mn.dbo.nslAfdeling? I know that in this case pcd_mn references the database on the server and nslAfdeling a table in that database. I also know that dbo references the owner of the database, but who is '..'? Thn...more >>

fulltext query problem
Posted by Dariusz Tomon at 5/23/2006 1:30:11 AM
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FU_SZ_B_B_S_M_W]') and xtype in (N'FN', N'IF', N'TF')) drop function [dbo].[FU_SZ_B_B_S_M_W] GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO SELECT ContactName, CompanyName FROM dbo.Suppliers WHERE CONTAINS(Co...more >>

Partitioned Table + File groups
Posted by Lalitha at 5/23/2006 1:21:02 AM
I have partitioned CustomerProfile related table as 20 partitions. These 20 partitions are placed in 20 different file groups. The partitions are designed to support approximately 100M records in the table. The deployment person says that in production environment I will have only 2 drive...more >>

a humdinger of a performance problem
Posted by Immy at 5/23/2006 12:00:00 AM
Hi all, Generally i'm helping to answer questions here, but i have strange problem that I haven't seen before, or at least such a difference in performance of a query. Scenario: I have my laptop (terrible spec) that has WinXP SP2, SQL2000 DEV EDITION + SP4. I have a datawarehouse tha...more >>

Size of some records
Posted by Prasad at 5/23/2006 12:00:00 AM
Hi, How can I get the size of some records from the table ? One option I can think of is copy those some records to a temp. table and then calculate the table size, but this is not feasible for me. Any other way. TIA Prasad ...more >>

Joining across databases
Posted by Simon Harvey at 5/23/2006 12:00:00 AM
Hi there, Can anyone tell me if its possible to perform a join on two tables that are resident in different databases - both databases are running on the same machine and under the same SQL Server 2005 instance. If anyone could tell me roughly how to do this then I'd be very greatful. If...more >>

DTS package to import a csv file on a web server
Posted by bj at 5/23/2006 12:00:00 AM
Im trying to schedule a dts package to import a database table from a csv file. In enterprise manager when i attempt to create the dts process, im not sure what datasource should i be using to connect to my csv file that resides on the web server? where do i specify me server to connect ...more >>


DevelopmentNow Blog