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 > november 2005 > threads for friday november 18

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

Is there any date function to get the last date of a month ?
Posted by Sha at 11/18/2005 10:21:02 PM
Is there any date function available to get the last date of a month. If not , How can I get it ? ...more >>


Logging Sql error to a table
Posted by Sha at 11/18/2005 10:17:01 PM
CREATE PROCEDURE GetData AS SELECT * FROM Bogus When I am executing above procedure I got following error. Server: Msg 208, Level 16, State 1, Procedure GetData, Line 3 Invalid object name 'Bogus'. I want to Insert above sql generated error message to a table from a procedure (Ver.SQl ...more >>

string length problem.
Posted by Toby at 11/18/2005 8:41:01 PM
Hello everyone, I've written a procedure to generate XML dynamically(structure). The procedure has a parameter which says the no of levels the xml would have. so i've wriiten the query as string in a loop declare @query varchar(8000) while @min<=@max begin set @query=@query+'seleect ....more >>

INSERT INTO WHERE NOT EXIST
Posted by Roy Gourgi at 11/18/2005 8:25:46 PM
Hi, I am trying to add a row to my table but I get the error message "invalid column name SOBN and BN1" on this statement. Basically, I am trying to add the row into the same table that I am searching if it does not find SOBN = 5 and BN1 =3. What is the problem? strCommand = "INSERT INTO t...more >>

Updating a table datetype
Posted by Dave Slinn at 11/18/2005 6:30:45 PM
I try to use the table datatype instead of temp tables (using the #syntax) when I need to work with a small recordset (fewer than 100 rows). However, I seem to have come across an unusual issue. I am attempting to update the columns in my @table from a table in the database, by Query Analyze...more >>

Grouping
Posted by Brandon Y at 11/18/2005 5:23:03 PM
Hello, my question is how can I get my data to read like this: Cat Small 10 BIG 5 Dog Small 7 Big 1 Is there a way to only list the main topic once and then the detail can be indented like so? ...more >>

Data that is absent
Posted by vm at 11/18/2005 5:06:01 PM
I have a single table which we use to keep track of data from different physical machines. The columns are: TheDate, TheName, & TheNotes. The Date column is datetime and the rest are char. Every day each machine we collect data on gets a row of information: The date of the collection, the mach...more >>

Conceptual and speed question
Posted by Roy Gourgi at 11/18/2005 4:31:01 PM
Conceptual and speed question Hi, My program seems to slow down drastically because as I fill my array and table with many values, the program suffers tremendously. The first thing my program does is to search the jagged array to try to find an element in that array. If it does n...more >>



Risk Factors with using LTRIM or RTRIM?
Posted by Justin Doh at 11/18/2005 4:04:04 PM
I am wondering if there is any risk involved using LTRIM or RTRIM that cut off data. What I mean by "cut off data" is that by using LTRIM (or RTRIM), data (other than empty space) is lost or deleted. And why should we not just use TRIM instead of using RTRIM and LTRIM together? For instance...more >>

Concurrency Checking - SQL Server Rowversion - Stored Procedures ASP.NET Command
Posted by Bari Allen at 11/18/2005 3:45:54 PM
I'm trying to test for concurrency, using a SQL Stored Procedure on a RowVersion (timestamp) Field. The vb code I'm using is as follows Dim cmd As New SqlCommand("ConcurrencyCheck", cn) Dim intID as integer = MyDataset.Tables("MyTable").Rows(0).Item("ID") cmd.CommandType = Command...more >>

DTS error on GUID column
Posted by Naveen at 11/18/2005 3:24:03 PM
I am doing a DTS from table "source" to table "destination". However "destination" has a primary key of data type uniqueidentifier and the source doesn't have a corresponding map field. So I thought setting the "destination" primary key to have a default value of newId() will automatically i...more >>

Best Practice Analyzer doesnt like my cursor
Posted by moondaddy at 11/18/2005 3:04:58 PM
I'm running the Best Practice Analyzer on my sql 2k server and one of many issues is about a bunch of cursors. The issue is for this cursor in an SP. Actually there are the same 2 issues listed for a lot of SPs they are: This cursor is declared as updatable (either explicitly or implicitly)...more >>

SPs from source control
Posted by moondaddy at 11/18/2005 2:46:00 PM
I have several databases (sql 2k) that appear to have stored procedures created by/for a source control. However, I have not assigned any source control (that I'm aware of) to these databases. Not all the dbs have these SPs, just a few dbs do. There names are like this: dt_addtosourcecontr...more >>

Simple Loop to get Frequency Count
Posted by Jim L at 11/18/2005 2:22:56 PM
Hello: I know this is very simple request, but I can't figure out how to do it in SQL, and it seems silly to write VB or something to do this. I have a table of Referrals (100,000 records - referrals to social service agencies), and a tblReferralFrequency which I created with Select Distinc...more >>

IF UPDATE Trigger in BOL
Posted by Test Test at 11/18/2005 2:08:39 PM
Please check this BOL example of IF UPDATE trigger which I am trying to use it but not getting the desired results. It is under Trigger Programming. A. Use the IF UPDATE clause to test data modifications: CREATE TABLE my_table (a int NULL, b int NULL) GO CREATE TRIGGER my_trig ON my_t...more >>

Passing arrays to SP
Posted by alto at 11/18/2005 1:36:28 PM
I am implementing a multi-variable search SP to which I need pass single values and arrays as arguments, e.g. exec mySP 'abc', {3,5,8}, 'en-US', {4,5}, ... etc How to pass the args to mySP and how to retrieve the values from the arrays inside the SP? TIA ...more >>

Help on Date
Posted by SG at 11/18/2005 1:04:52 PM
Hi, I'm new to SQL. I like to pick up the previous date. How can I do this? I have a date field in my table with mm/dd/yy 12:00 AM. I want to do a query to get the previous day's date. How do I convert the date to the previous one? For example: today is 11/18/05 12:00 AM, I like to get 1...more >>

ERROR: OLE/DB Provider 'MSDAORA' ITransactionJoin::JoinTransaction returned 0x8000d048
Posted by Andrea Temporin at 11/18/2005 1:00:32 PM
I've got this error message doing something like this: table A inside a SQL DB, table B inside a linked ORACLE DB; begin transaction; insert into table C inside a SQL DB select fields from A join to B I've got the problem only in a particular configuration: SQL 2000 sp4, Oracle Client 9.2,...more >>

user-defined function and stored procedure
Posted by Iter at 11/18/2005 12:56:01 PM
Do you think user-defined function has better performance than stored procedure in SQL Server....more >>

Limit to one value in fld b for given value in field a
Posted by Arthur Dent at 11/18/2005 12:51:37 PM
Okay, i have a problem, which would be easy in a well-normalized db, but im working in a legacy app here, and can't normalize the db because it would break the existing apps around it. I have a manifest table which essentially acts as both a header & line-items table. There is a MANIFESTID f...more >>

display time
Posted by culam at 11/18/2005 12:35:04 PM
How do I display time from 23:00:00 to 11:00pm or vice versa, Thanks, Lam...more >>

FMTONLY ON - strange
Posted by Catalin NASTAC at 11/18/2005 12:27:05 PM
Hello, I have this alter proc MyProc @Param int = NULL as begin if @Param is null begin set FMTONLY ON goto FinalStruct end -- some calculation based on some tables, let's say declare @Cnt int select @Cnt = count (*) from s...more >>

SHA-256 hashing in SQL ?
Posted by AlexT at 11/18/2005 12:05:26 PM
Folks I'm currently working on a project where I will need to store hashed passwords in a table using SHA-256 neither MD5 nor SHA-1). I'd be glad to hear any suggestion as of the best way of implementing this, both in terms of ease of coding and throughput. Targeting 2000 only - .NET fra...more >>

Dynamic CLR Table-Valued Function
Posted by Fernando at 11/18/2005 11:57:15 AM
Is it possible to create a CLR Table-Valued Function in SQL 2005 in which the fields can be defined at runtime? In other words, table-valued function must define a table definition in the [SqlFunction] attribute, which makes the definition of the columns you are returning from the function sta...more >>

Index gone bad?
Posted by Devers at 11/18/2005 11:47:57 AM
Greetings- We've recently had a problem at two different customer sites (that we know of) where the query optimizer seems to be ignoring an index for a simple join. The query is simply: SELECT tbl2.* FROM tbl1, tbl2 WHERE tbl1.col1 = tbl2.col2 AND tbl1.col3 = ?someinteger Col1 has a...more >>

Update DB table based on lookup
Posted by Griff at 11/18/2005 11:18:50 AM
This is really a conceptual question; I'm after the best way to update a table whilst using a lookup in another table. Imagine that I have table A with 4 columns and table B also with four columns Conceptually, what I'd like to do is the following: Update table A Set A.field1 = B.field...more >>

Rotate table query help
Posted by Randy K at 11/18/2005 11:18:08 AM
I need to join two tables I guess in a rotate fashion but have not been able to figure it out. We have a Taxo_Status table that contains up to 2 entries per species. These records need to be joined Taxo_Status_LUT table such that one record is turned per species with a state status description...more >>

Synchronising SQL Server 2005 Express & SQL Server Mobile
Posted by Paul Aspinall at 11/18/2005 11:12:28 AM
Hi I am looking for info. on how to synchronise a database on SQL Server 2005 Express, to SQL Server Mobile on my PDA. I want to have an application which can either update the data on either version, and have them synchronise back to each other. Can anyone point me in the right direction...more >>

Update Query help
Posted by Marty at 11/18/2005 11:04:16 AM
Hi, I am a real newbie when it comes to this stuff. I have 2 databases in MS Access. (I know this is a SQLServer group but I need to learn to walk b4 I try to run) Each has a table called taps. These tables are almost exactly the same except a couple columns. I imported taps from one database in...more >>

Error msg 8616
Posted by JN at 11/18/2005 10:59:49 AM
Hello, I got this massage, 'Warning: The query processor could not produce a query plan from the optimizer because the total length of all the columns in the GROUP BY or ORDER BY clause exceeds 8000 bytes' How I can do it? Thanks, JN ...more >>

Datatypes in CLR stored proc
Posted by Rick Razzano at 11/18/2005 9:59:45 AM
I'm having a problem getting the types right for a CLR stored procedure. First, do you always have to use nchar/nvarchar parameters? I was getting errors trying to use varchar parameters in the T-SQL. Second, I can create the proc, but when I execute it, I get the following error: Msg 6...more >>

Utf-8 and sql server
Posted by Andrej ®eleznik at 11/18/2005 9:56:25 AM
Hello, We developed a web based application using utf-8 char set. How to configure sql server to run ok with utf-8 char set? Andrej Zeleznik Ljubljana, Slovenia ...more >>

Funny DateTime Issues
Posted by yurps at 11/18/2005 9:15:10 AM
Hello this is weird when I run this on a Friday SELECT DATENAME(dw,5) --> returns 'Saturday' Select DATEPART(dw,GETDATE()) --> returns 5 Can anyone explain why this would occur? ...more >>

Select from stored procedure
Posted by sa.cesare NO[at]SPAM gmail.com at 11/18/2005 9:13:39 AM
How I can "select" from stored procedure-something like: select * from sp_tables_ex @table_server='x' Thanks. ...more >>

SQL Performance (UPDATE)- Which query would be quicker......
Posted by TrinityPete at 11/18/2005 9:06:01 AM
If I have a SQL table with Columns A B C D and an Primary Key of A then which of the following would perform better - OK I know it depends on volumes etc, but just by examining the query is it better to update more than actually required so you can use the primary key and therefore index seek,...more >>

SQL and XML: Why is it so hard???
Posted by Grant Smith at 11/18/2005 9:03:10 AM
OK... I'm trying to import data that is sent to my company in an XML file into an SQL database. My first solution was to write a VB app that used SQLXML Bulk Load 3.0 and that didn't work, so I tried another option provided to me in this newsgroup and that didn't work. Now I am now tryin...more >>

Can we handle ALL errors within a stored proceudre?
Posted by Andrew at 11/18/2005 9:01:14 AM
Hello, friends, We call stored procedures from our app (asp.net), and use Try...Catch to handle any possible DB error. But, can we handle all errors in a stored proceudre? In another word, all DB errors should be caught within a stored procedure, and return back to callers gracefully, as if...more >>

Where's Query Analyzer
Posted by Chris Yager at 11/18/2005 8:52:07 AM
So we upgraded. Now I'm stuck with Management Studio - which seems to be a great tool. However, I spend most of my time performing one-shot queries against one or more of my client's databases and Managment Studio is like using a jack-hammer to put in a nail. It works but all you needed was...more >>

Can we handle all errors within a stored proceudre.
Posted by Andrew at 11/18/2005 8:48:08 AM
Hello, friends, We are calling stored procedures (sp) from our web app (asp.net). Since using Try...Catch... in asp.net with C# or VB.net is very expensive, we are considering to handle all database error in sp so that web app won't see any DB error. Do we have a way to catch all erros i...more >>

Add unique id column - newbie
Posted by ks at 11/18/2005 8:44:09 AM
I have a table (inherited) that gets data from a DTS package. The problem is that the table that the data is being read in to wasn't created with a unique id field. Is there a way that I can add a unique id field and have it populated? This table has 86000 records in it already. TIA...more >>

How to restore a customer database on my server with SQLDMO ?
Posted by Sylvain Aufrère at 11/18/2005 8:42:05 AM
Hello, I want to restore a customer database on a empty database of my server. The two bases have different names and different paths for datas & log. How to do that with SQLDMO? Thanks...more >>

Default field to another field
Posted by Altman at 11/18/2005 8:35:25 AM
I am using SQL Server 2000. Is there a way to have a field default to the value of another field if it is not provided? and how? -- TIA Altman ...more >>

ref int between tables in 2 DBs
Posted by Rob at 11/18/2005 8:25:50 AM
Hi... this is a multi-part question on the topic of setting up referential integrity between two tables, one on each separate DB, on the same server. First, is this even possible? If yes, then how would the foreing key be referenced? And what if the referential integrity were to expand betwee...more >>

How do I format mailing address fields for display in reports
Posted by Foofs at 11/18/2005 8:25:18 AM
I am very new to development with SQL Server but I have lots of experience with Access. I am producing a report in VB.Net using CrystalReports that will display a company's address differently depending on the contents of the data. For example, if the second address line is NULL then I don't wan...more >>

InterBase's FOR SELECT..SUSPEND equivalent in MS SQL Server 2005
Posted by Contraptor NO[at]SPAM gmail.com at 11/18/2005 7:30:19 AM
Hello everyone. I've been wrestling with this one for a while now and am hoping you can help. My company is moving from InterBase to MS SQL Server 2005 in the very near future and all has gone well so far, but there is a stored procedure on the InterBase database that I have had trouble findi...more >>

Alternative to cursor
Posted by zubine NO[at]SPAM gmail.com at 11/18/2005 7:04:41 AM
Hello, I would like to find and alternative to using a cursor and updating my table with the calculated values. The following code snippet is from my store procedure. -- Calculate and Update LEWeightedTerm and LEWeightedRR DECLARE LECursor CURSOR FOR SELECT TransactionID, Term, Busine...more >>

Compatibility_52_409_30003
Posted by Wangkhar NO[at]SPAM yahoo.com at 11/18/2005 6:54:34 AM
Hi Sorry to those caught in this cross post, but the setup group is a bit dead...you guys are usually spot on. I am trying to set up a hot spare server. The production database is set up with server collation Compatibility_52_409_30003 (and for teh database too). I am having a problem...more >>

How to read not for replication setting from meta info
Posted by ppschmitz NO[at]SPAM gmx.de at 11/18/2005 6:49:52 AM
Hello! I am trying to read the not for replication setting of an identity column from a Sql Server 7.0 database but I cannot find that piece of information. I check the information_schema tables that look approriate and the sp_pkeys procedure. But no luck. Has anyone an idea? Thanks f...more >>

CROSSTAB QUERY FROM ACCESS TO SQL
Posted by lisa.graham NO[at]SPAM openandirect.com at 11/18/2005 4:23:56 AM
Hello, I'm quite basically new to working with SQL databases, coming from a Microsoft Access background. As we've got the SQL server sitting here, I've been asked to get the MS Access db's moved across onto it. I've had no problem with the tables, but as the majority of the reporting comes ...more >>

OT: SQLCLR/Broker etc
Posted by Niels Berglund at 11/18/2005 2:12:22 AM
Sorry for the Off-Topic post, but is this now the recommended place to post re SQL 2005 new development features; SQLCLR, Service Broker etc? Niels -- ************************************************** * Niels Berglund * http://staff.develop.com/nielsb * nielsb@no-spam.develop.com * "A F...more >>

Problem in Instead of Delete Trigger
Posted by vinoth NO[at]SPAM gsdindia.com at 11/18/2005 2:09:04 AM
Hi, I have Instead of Delete Trigger in my Table. When i delete any row from the table it shows the No of Rows affected ex:- 1 Row affected But when i look into the table the Deleted Row is still Present. My Question is If there is Instead of Delete Trigger then is it not possible to...more >>

SMO and Management Studio
Posted by Allan at 11/18/2005 12:31:02 AM
Hi! Is there anyone that have figured out how to add a servers and groups to the "Registered Servers" in Management Studio using SMO. I'm having problem understanding how to use the RegisteredServer and ServerGroup objects in SMO. Examples in VBScript would be really nice but all pointers a...more >>

Full scripts
Posted by Enric at 11/18/2005 12:01:05 AM
Dear folks, I’m wondering how do I obtain full scripts of all the current databases in a Sql Server of an automated way instead of choose one in one out from EM. Does anyone knows or is awared of any mechanism for that? Thanks in advance and regards, ...more >>

Enumerating SQL Server database tables rows and sprocs using MFC
Posted by Stilgar at 11/18/2005 12:00:00 AM
Hi, I've been looking around for a while now after an efficient way to enumerate tables, rows and sprocs of a MsSQL database. The best I could come up with was SQL DMO, but one cannot have it installed without installing SQL Server itself or MSDE, so I'm looking for alternative. After a ta...more >>

some XML question
Posted by denis_rusakov NO[at]SPAM epam.com at 11/18/2005 12:00:00 AM
Hello, I've got some question about XML. I have such script - declare @table table (i int, x xml) insert into @table (i, x) values (1,'<a>av</a>') insert into @table (i, x) values (1,'<b>bv</b>') insert into @table (i, x) values (2,'<c>cv</c>') select * from @table and I want to get ...more >>

SQL Server 2005 Generate Insert statements
Posted by Mark Nijhof at 11/18/2005 12:00:00 AM
Hi, Is there a way that SQL Server 2005 generates insert statements for the data it holds? Forexample I have a table with some default values that I want to export to. On the instalation I would like to be able to run the sql script instead of having to restore a backup. Thanks, -Mark...more >>

Variable declaration
Posted by Pradeep Kutty at 11/18/2005 12:00:00 AM
Hi All, In the below code, I declare variable @var2 inside the else part of the statement. The code is written in such a way that the flow of control does not go into the declaration part. I expected an error saying variable not declared, but the code runs without any error. Could some...more >>

if exists
Posted by Mauro at 11/18/2005 12:00:00 AM
i have this: if exist(select * from sysobjects where name= 'table' and type = 'u' ) begin update table set a=1 where b=2 end and its giving me an "INVALID COMUN NAME B" error,because of course it does not exists but in sql 2000 its works perfectly, i noticed that in 2005 on another datab...more >>

SQLXML 3.0 Error:
Posted by Grant Smith at 11/18/2005 12:00:00 AM
After many tries, I have gotten a SQLXML Bulkload to function in my VB app. However, it is now giving me an error from some of the files that I can't understand. The function is: Private Function importToSQL(ByVal importXML As String) Dim noErrors As Boolean D...more >>


DevelopmentNow Blog