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
August 2008
all groups > sql server programming > april 2005 > threads for tuesday april 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

Converting mySQL database to SQL Server - Help
Posted by HumbleCoder at 4/12/2005 10:17:08 PM
I am looking to convert a mySQL database to SQL Server 2000 or 2005. I am interested in converting the structure, data, constraints, keys, etc. I have some experience with SQL server but none with mySQL. I am a C# programmer not a DBA. I am looking for some guidance on the best way t...more >>


Organize tables within a DB?
Posted by Raterus at 4/12/2005 5:30:32 PM
Hi, I'm using Sql Server 2000 currently. One of the problems in my = organization is we have one SQL Database that is huge, 300+ tables, 200+ = sprocs. Apart from breaking this DB up in many smaller databases, is = there some way, current or a future version of sql server, to better = organize...more >>

regconize update or insert in trigger
Posted by Martin at 4/12/2005 5:25:54 PM
Hi, I want to write a trigger INSTEAD OF on a table. In this trigger I must = regconize, if the trigger is fired by INSERT or UPDATE action, in order = to do special thing for each case. But I can not to write 2 trigges, one for INSERT, one for UPDATE, = because I may only one INSTEAD OF trig...more >>

Trigger problem
Posted by Shimon Sim at 4/12/2005 5:20:41 PM
I have a trigger that updates summary information for insert and delete. It seems that delete works if I do delete of the row dirrectly on the table DELETE FROM Entry WHERE EntryID=... This Entry Table is connected to CustomerTransaction table with relations that updates and deletes Entry ta...more >>

NOT EXISTS
Posted by Simon Worth at 4/12/2005 4:50:58 PM
Are there any limitations to the NOT EXISTS clause within a SQL statement? I have a large query that is querying a table that holds sequential data for customers. It gives me a complete transaction history of any account based on a datetime stamp. The query has 5 AND NOT EXISTS clauses in i...more >>

How can i retrive estimated time of query?
Posted by Konstantin Knyazev at 4/12/2005 4:37:13 PM
Hi! Is there any way to estimate time of query executing? There are Display Estimated Execution Plan with some costs, but how can i estimate required time in seconds? Thanks! Best regards, Konstantin Knyazev ...more >>

Data from Three Tables
Posted by Gary Paris at 4/12/2005 4:24:01 PM
I have three tables: Contact, Staff, Codes. My SQL statement is as follows: SELECT tm5user.contact.full_name, tm5user.contact.phone1, tm5user.contact.firm, tm5user.contact.city, tm5user.staff.[last], tm5user.staff.[first], tm5user.codes.[desc] FROM tm...more >>

Newbie Question.
Posted by Sami at 4/12/2005 4:22:50 PM
Hello, Here are the things that I need to do for my client application that connects to MSSQL Database. 1) I need to figure out how many connections are made to the database. 2) I need to figure out how many cursors are connected to a particular database. How can I do these? I found a w...more >>



Retrieving the version of the server
Posted by Ottar Holstad at 4/12/2005 4:17:44 PM
Hi, is it possible to retrieve the version of a SQL Server by using SQL? ...more >>

partitioned views
Posted by skilla31 at 4/12/2005 2:53:50 PM
Hi, I've set up a partitioned 'updateable' partitioned view. The view unions identical tables which contain a horizontal slice of the data. the partioned column is a combined key. Constraints are in place on all tables to ensure the correct data goes in to the right tables. I've successfull...more >>

insert into 2 tables
Posted by Hrvoje Voda at 4/12/2005 2:42:19 PM
How to insert an integer value into to tabels? The same value must be in both tables. The problem is that integer is generated automaticly, so I don't know the specific value when I do the insert. Hrcko ...more >>

CASE in Select
Posted by Mark Goldin at 4/12/2005 2:31:02 PM
I am trying to get something lik this working: select ...... where .... and user_id = case @userid when <> 0 then @userid end I need to conditionally use user_id = @userid when @userid <> 0 Thanks ...more >>

ntext
Posted by Mark at 4/12/2005 2:27:17 PM
Is there a quick query that would identify if any characters being used in an ntext column actually require the ntext, rather than just text? Perhaps a query looking for any character where the ascii equivalent is out side the "text" range?? thanks in advance. Mark ...more >>

what's an efficient way to find if a value exists in a table?
Posted by Zeng at 4/12/2005 2:11:47 PM
Hi, Please share your comment or advice on this. This is urgent for me. I would like to find if searchId exists in the table2, but the tables has many rows, would you know an alternative that would do it faster? I'm going to make SearchId an index thinking that it would help but not sure if...more >>

identity columns
Posted by Jason at 4/12/2005 2:04:59 PM
Hi, How can i insert from a select statement where in the select part has 2 identity columns. When i insert it in a table which i create on the fly, the insert fails. ...more >>

Multiple Cascade Path restriction
Posted by Adrian Parker at 4/12/2005 1:23:51 PM
When using RI to do cascade deletes, why is there a restriction based on multiple cascade paths ? Yes I know how to get round the problem, but our application works on the other major DBs so we're not going to change it just to work on one, so we're forced to use triggers just one this one ...more >>

How to query two tables from different database
Posted by SG at 4/12/2005 1:07:05 PM
Hi, I'm trying to query some data from two database (d1.tbl1 and d2.tbl2). How can I do this? I'm new to SQL. Thanks in advance, Sarah ...more >>

There has to be a better way to get duplicate records... ?
Posted by roy.anderson NO[at]SPAM gmail.com at 4/12/2005 1:06:14 PM
Greetings, My stored proc is below. It works fine, but takes around 20 seconds to complete. Could anyone please eyeball it and let me know if you have any suggestions to make it more efficient? At first it returned around 3000 records, so I stuck in the "top 10" modifier, but that didn't show a...more >>

help with a query
Posted by ishaan99 via SQLMonster.com at 4/12/2005 12:38:51 PM
I have 2 tables with data as. Table A FName LName Value John Brown Chris Smith P DeSouza P DeSilva Table B FullName John Brown Chris Smith P De Souza P De Silva I am trying to write a query which will update Value column in Ta...more >>

T-SQL version of Find
Posted by Tod at 4/12/2005 12:32:24 PM
Pardon my newbieness. If I had this value in the field called Field1: Public, Johnny I want to return only the last name. I would normally do this in VBA: LEFT(Field1,FIND(",",Field1,1)-1) I'm trying to do this in T-SQL. I've discovered the SUBSTRING function. So I can do this: ...more >>

Timeout issue, just a few troubles
Posted by Enric at 4/12/2005 12:32:02 PM
Dear all, I've got a stored procedure and inside it, a cursor is running after a couple of no massive update . In a short, it doesn't take more than 1 minute but when I launch this sp from VB front-end sometimes I obtain timeout error. It's amazing I am talking about 300 or 400 rows popula...more >>

Determing/Writing a Stored Procedure matrix
Posted by Logger at 4/12/2005 12:27:30 PM
Looking for some suggestions on writing a Stored Procedure that have several Parameters, some with 2 possible answers. Example of Parameters: One possible answer 1. @ActCompanyid= a Company id, @BegDate, @Enddate Two possible Answers 2. @Showid = # / ALL # = specific show / All = ...more >>

SELECT LAST_INSERT_ID() keeps returning 0 AHHHH!!
Posted by Rizyak at 4/12/2005 12:06:19 PM
x-posted to: alt.comp.lang.php, alt.php.sql, microsoft.public.sqlserver.programming ********************************************************************* I am trying to associate an event with a venue through a single form that asks for venue information, contact information and event inform...more >>

Dynamically Drop FK Restraints?
Posted by xenophon at 4/12/2005 11:55:01 AM
I was wondering if anyone had anything in their bag of tricks that would detect any foreign key contraints on a table and break them. I am constantly dropping/adding tables as part of a MSSQL 2000 utlity function and I keep hitting an error if I drop a parent table that has FKs. Thanks. ...more >>

Generating an audit trail in SQLS 2000
Posted by Chris Strug at 4/12/2005 11:53:14 AM
Hi, Following on from a recent post regarding Identity fields with David Portas, I was discussing a few issues with a collegue and an interesting issue was raised. Namely, creating an audit trail in which every row is assigned a unique, gapless sequential reference. For example, our account...more >>

- Database Scripting Question
Posted by Amos J. Soma at 4/12/2005 11:51:20 AM
I just used Enterprise Manager to create a script of my database. My goal is to take this script and run it on another server to create a copy of the database. When I ran the script to re-create the database, I got numerous errors because Enterprise Manager created the script in such a way tha...more >>

DATETIME field
Posted by WB at 4/12/2005 11:16:06 AM
I have a CreatedDate column of type datetime. I am trying to query for CreatedDate = somedate, but not results are returned. I understand this is because the time is also included in the data will never equal a specific date. BOL recommends doing a string comparison using LIKE; however, it do...more >>

How to stay flexible?
Posted by Brett at 4/12/2005 10:48:41 AM
I'm currently using CFMX with an SQL Server 2000. However, I'm moving to more cost efficient solutions such as ASP.NET and some other database, which I haven't determined yet. The database will probably be MSDE or MySQL. I don't do many transactions, so either of those two choices should be...more >>

Passing 'date' parameter to Jet 4.0 linked server - collation problem?
Posted by StanislavO NO[at]SPAM ved.ru at 4/12/2005 10:44:32 AM
Hello, I've attached Access MDB as a linked server to SQL 2000 server. Now I want to run distributed queries. I set 'collation compatible' option, so when I reference an Access MDB table in WHERE clause, the parameter is passed to Access data provider. But I can't do the same for Datetime colum...more >>

table design for default FK
Posted by David J Rose at 4/12/2005 10:42:51 AM
If I have two tables: create table test1 ( TestID INT NOT NULL IDENTITY(1,1) PRIMARY KEY, description varchar(50) NOT NULL, defaultTest2ID INT NOT NULL --default test2 row ) create table test2 ( Test2ID INT NOT NULL IDENTITY(1,1) PRIMARY KEY, description varchar(50) NOT NULL, TestID I...more >>

Table Join Problem
Posted by Bob Cannistraci at 4/12/2005 10:30:02 AM
In a SP that joins 4 tables, the system needs to select a corresponding date from one table (lines.line_start_date or lines.line_end_date) if in the other table either date field (emp_line_activity.actual_start_date or emp_line_activity.actual_end_date) are null. However, the SP joins rows tha...more >>

Nulls in indexes
Posted by Aaron M. Lowe at 4/12/2005 10:26:33 AM
Hi, If I have a column that allows NULLs and the majority of the queries that run against the table look for rows when that column is NULL. Would an index increase the performance of the query? Thanks, --AML-- ...more >>

Floats with no scientific notation
Posted by Brian Ackermann at 4/12/2005 10:21:01 AM
Hello, I've been searching the groups for a way to accomplish this, but I've come up short. What I ultimately need is a way to count the number of decimal places in a floating point number (ie 37.88955 ==> 5, 0.02 ==> 2, etc). What I'm currently working on is how to convert a float to deci...more >>

Converting a Concatenate Query
Posted by Cheryl at 4/12/2005 9:51:37 AM
This worked in Access, but I'm not sure how to convert it for use in SQL 2000: Concatenate("SELECT Abbreviation FROM TblChargesDetailed WHERE CaseNmbrID =" & [CaseNmbrID]) Basically, the Concatenate code takes a list of items in another table and strings them into a single field separat...more >>

getdate() in UDF
Posted by Mark Goldin at 4/12/2005 9:44:18 AM
I am trying to use getdate() function inside of my UDF function. I am getting an error message about invalid use of getdate() function. Is there a way to use functions in UDF functions? ...more >>

Help with date format in View
Posted by FloridaJoe at 4/12/2005 9:35:01 AM
I'm using a view to prepare the data I want to export with DTS into a comma delimited file. The SQL it creates is: SELECT TOP 100 PERCENT LicenseNo, PropertyNo, AmountPaid, DatePaid, PrimaryFee, TransferFee, PenaltyFee FROM dbo.Fees WHERE (AmountPaid > 0) ORDER BY LicenseNo ...more >>

Tracking Hackers
Posted by Peter Nolan at 4/12/2005 9:16:02 AM
Dear All, Recently our database was 'hacked at' by a remote service. What I would like to do is capture the machine name (I can get that from the Process ID) of the hacker. In this case the hack was unsuccessful. I know there are ways of doing this on Server 2003, but I would like a way o...more >>

using hierarchical roles to limit select
Posted by David J Rose at 4/12/2005 9:02:24 AM
I got no solutions last time, so thought I would try and make the question more understandable (The DDL is at the bottom): (1) I have a table that uses some hierarchical SQL Server roles. (2) There are always rows in the table for the top-most role ("Complete"). (3) Sometimes, I want to overr...more >>

MS SQL 2000 LEFT OUTER JOIN and RIGHT OUTER JOIN problem?
Posted by Rob R. Ainscough at 4/12/2005 8:58:48 AM
I'm a little confused with a JOIN that should be working but isn't. If I run the same SQL statement in MS Access (same data) I get the join results I expect. If I run the SQL statement in Enterprise Manager I get a different result (again same data). I thought both are supposed to be ANSI...more >>

reporting on BLOB fields
Posted by Marc at 4/12/2005 8:53:04 AM
Hello, I am hoping that someone can help me out with this. I am trying to debug a product that I support, the application creates its own SQL when executing reports. The report I am trying to execute requires a field that is a BLOB, see the SQL below, the result is not what I was expect...more >>

Duplicating a Record in a View
Posted by Joe Williams at 4/12/2005 8:36:33 AM
Is there a way in SQL to take one record from a table and duplicate it a certain number of times (Basically create a view that has the same record repeated) For instance, if a record is SMITH, JOHN, 1234 and I specify I need 3 duplicates then teh resulting view would be: SMITH, JOHN, 123...more >>

updating values in a table
Posted by Munch at 4/12/2005 8:06:02 AM
I am running an update statemnt against TableA Update TableA Set Column1='AAA' where column1='BBB' The command executes, but withing 5 seconds reverts back to the old value (BBB). I tried copying the table and renaming it and updating that one, same thing happens, does someonw know why ...more >>

Efficient Code round 2
Posted by Jazz at 4/12/2005 7:52:13 AM
I have taken the recommendations that I was given with my first posting of this procdure code. I greatly appreciate the help. I have written my 2nd attempt and would like to get feedback on this version for anything else that can optimize the queries. Here is the code: -- Procedure ...more >>

Time substraction
Posted by Theodora at 4/12/2005 7:18:04 AM
Hi, I want to substract an end time from a begin time in a query and have the folowing. Begin Time = 8:00:00 AM Time In = Monday, 28-03-2005 08:18:16 AM Time Out = Monday, 28-03-2005 06:20:34 PM to substract Time Out - Time In is very easy, but to substract Time Out - Begin Time is my...more >>

calculating with variables statistical values. How?
Posted by Enric at 4/12/2005 6:48:04 AM
Dear all, I am trying to solve this but I can't work out. Set @DESV_INSERTED = (SELECT stdev(desv) FROM #DESVIATIONTYPICAL WHERE desviation_id = @desviation_id AND desv > 0) SET @AVERAGE = (SELECT AVG(DESV) FROM #DESVIATIONTYPICAL WHERE desviation_id = @desviation_id AND desv > 0...more >>

Float return
Posted by PBrent at 4/12/2005 6:45:37 AM
When the table below is created -the data selected is different for values > 10. Does some one know why float behaves this way ? - I am stumped create table tempdb.dbo.TestValue (ColId int, TheValue Float) Insert into TestValue Values (1, 10.25) Insert into TestValue Values (2, 10.99) In...more >>

assign variable value in Exists subquery
Posted by Ann at 4/12/2005 6:40:02 AM
Hi How to assign a variable value from if exist ? like declare @i int if exits( select @i = ID from table1 where ID = 100) -- do sth but I always get an error Thanks a lot for helping...more >>

Join multiple tables
Posted by GrzesB at 4/12/2005 5:25:02 AM
Hi I'm new to SQL and I have the following problem. I've 3 tables: table1 (with columns a1, b1, c1), table2 (a2, b2, c2), table3 (a3, b3, c3). I have to build joined table with columns like this: col1 (a1 or a2 or a3), col2 (b1 or b2 or b3), col3 (c1), col4(c2), col5(c3). a1=a2=a3, b1=b2=...more >>

Find uniques on part of a multi-column PK (with where clause)
Posted by Mario F. at 4/12/2005 4:58:16 AM
Hello all, Follows a simplified DDL of the table where i'm working on: CREATE TABLE Test ( TestID bigint NOT NULL , SubTestID bigint NOT NULL , Name varchar (50), Master bigint NOT NULL , CONSTRAINT PK_Test PRIMARY KEY CLUSTERED ( TestID, SubTestID ) ) What I'...more >>

Migrating from Sybase to SQL Server 2000
Posted by João Costa at 4/12/2005 2:22:01 AM
Hello, I'm having a problem migrating a particular stored Procedure wich runs nested and interdependent Fetching within a cycle. There is a main cursor and from that, a var is retrieved for use as a parameter for other cursors. The most important is that the all Cursor's queryes run suc...more >>

dec to varchar
Posted by Esko at 4/12/2005 1:26:02 AM
Hello, I need some help with string functions. I have these statements: declare @text varchar(30), @quantity dec(32,12), @date datetime select @text = 'qwerty', @quantity = -123.123456, @date = getdate() select @text + ';' + convert(varchar, @quantity) + ';' + convert(char(10), @date, ...more >>

SQL Query Help
Posted by Sanka at 4/12/2005 12:39:03 AM
We have a table with the following schema StudentID Elective Marks 1 English 80 1 Physics 72 1 Maths 98 2 Spanish 86 2 Biology 87 3 Social 81 3 ...more >>

Calculate Lastmonth in an SP
Posted by Mark at 4/12/2005 12:05:37 AM
Hi - from within an SP (which is run automatically), how would I determine range for 'last month' - eg. this is April, so I would like my SP to be able to calculate 1 March 2005 to 31 March 2005??? My problem is for this: I have a .net web application which keeps track of time for consultants....more >>

Identity vs GUIDs vs COMB GUIDs vs NewSequentialID?
Posted by Joergen Bech NO[at]SPAM at 4/12/2005 12:00:00 AM
Given a table IID bigint (Identity) GID guid (PK) ParentID guid Value nvarchar(400) with indexes on ParentID, Value Value, ParentID Now, if I put the clustered index on IID, I get great INSERT performance because new records are added to the end of the table al...more >>

No formulas in Stored Procedure params?
Posted by Axel Dahmen at 4/12/2005 12:00:00 AM
Hi, is there any reason why it is not allowed to use formulas as Stored Procedure parameters? e.g.: EXEC myProc(@myVar + ' ' + @myVar2) I could make use of this feature over and over if SQL Server 2k would allow me to. Axel Dahmen ...more >>

Error message ID returned to the application
Posted by Frank at 4/12/2005 12:00:00 AM
Hello, I want to know whether I could get the Raiserror's message id in the front end's application, (coded in Visual Basic or Delphi). Thanks in advance Frank ...more >>

Default of a Sproc Pasrameter
Posted by John DeHope via SQLMonster.com at 4/12/2005 12:00:00 AM
Using syscolumns or an equivalent, how can you find the default value, if any, of a sproc parameter? For example given this sproc... CREATE PROCEDURE spTest (@X CHAR(15), @Y DATETIME = '1/22/1975') .... How would you find that @X does not have a default, and that @Y does? Thanks in adva...more >>

BULK INSERT
Posted by Joel Gacosta at 4/12/2005 12:00:00 AM
Hi All, I want to BULK INSERT from a text file to SQL but I only want to insert the lines that begin with 'valid'. Is it possible? Is there a link where can i find help with this problem? Thanks! joel ...more >>

Counts in Date Ranges
Posted by Nitin M at 4/12/2005 12:00:00 AM
Hi, I have table with the following structure User Name, Name of Product, Date of Purchase I want to find out the number of times a particular product was purchased by anybody in the last 30, 60 and 90 days. Is there any function in SQL that will give this type of distribution? What ...more >>

trigger help
Posted by Martin at 4/12/2005 12:00:00 AM

Trigger Help
Posted by Martin at 4/12/2005 12:00:00 AM
Hi, I am writing a trigger for Insert and Update, which raise an error, when column Field2 contains incorrect value(empty, or duplicate in table)... Now I edit a record, when I make the error to fire the trigger, my error message is not displayed, instead of it SQL Server shows me 2 diffenrent ...more >>

Conncetiviti error
Posted by Villi Bernaroli at 4/12/2005 12:00:00 AM
I have this error only when reading a certain file from SQL server, and not with all the other files, so it's very strange. I have a Visual FoxPro cursoradapter who gets populated with a record from a table in SQL server, and the CursorFill method of the CursorAdapter (which populates it usin...more >>

charset
Posted by Win at 4/12/2005 12:00:00 AM
I've created a table with an Nvarchar field in SQL server. When I insert a chinese word using Query Analyser, I can use N'chinese word for updating. Howeve I can update the chinese word from web page. Can anyone help me? Thanks ...more >>


DevelopmentNow Blog