Groups | Blog | Home


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 > july 2003 > threads for thursday july 17

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

how to dump database
Posted by liu at 7/17/2003 10:38:25 PM
I have a database JQK which was dumped out from another sql server(MSSQL 2000). Now I want to dump JQK wholy into a new sql server by code. How can I do? the environment is Windows 2000 Professional MSSQL SERVER 2000 thanks liu ...more >>

Views or WHERE
Posted by Ray at <%=sLocation% at 7/17/2003 10:02:48 PM
Hi group, Generally speaking, is there any sort of rule of thumb as to when it would be better (faster, more efficient) to start using views instead of using WHERE clauses all the time? For example: Table: Users UserID int, identity '''other columns like username, password, etc. Table...more >>

Need Help -Expected end of statement
Posted by dalethom at 7/17/2003 8:58:22 PM
I really could use some help with this query... Here is query strTicker = "insert into ticker1 values ('" & request.QueryString("line") & "'), ('" & request.QueryString("text") & "')" ; Here is my error: Error Type: Microsoft VBScript compilation (0x800A0401) Expected end of stat...more >>

Case with Nested In Select Not Working
Posted by sc at 7/17/2003 6:38:18 PM
Having trouble with a (not so?) simple select-case statement. The stored proc should a datetime value and an operator and retrieve datetimes based on that operator. The error I get is Server: Msg 156, Level 15, State 1, Procedure #stuffproc, Line 19 Incorrect syntax near the keyword...more >>

huge table and view
Posted by T H at 7/17/2003 5:49:18 PM
Here is the situation: My application creates a record in the table A for each of the user session with a unique ID and some other user information. After a while this table is getting huge(think of billions of rows). We want to get rid of some old or unused data from the table in order to imp...more >>

Query Help!
Posted by ksbrace at 7/17/2003 5:30:26 PM
Hello, I have a tempTable with the data I need, just one column. I need to put the entire column into another table. I need to put the FmeaID from the TempFmea table into the column FmeaID in the table called tblItem_FMEA_ViewDetails. I'm sorry for my ignorance, but I am somewhat new to this. ...more >>

SQL SELECT Excluding data
Posted by Stephen Howe at 7/17/2003 5:20:25 PM
I have table called Track of the form [date] integer panel integer channel integer flags integer where [date],panel,channel are the PK in that order and flags is a bit coded field. So I can have data of the form [Date] Panel Channel Flags 37750 6 2 ...more >>

stored procedure that calls other procedures
Posted by Edgard L. Riba at 7/17/2003 4:56:36 PM
I have a more or less complex stored procedure that inserts/updates on a number of tables. It sets up a cursor through an inventory transaction's rows. For each row, it sets up another cursor for the item's inventory to calculate the inventory variation. Finally I want to call within the stor...more >>



SQL Statement
Posted by Paul at 7/17/2003 3:45:29 PM
Hi all I have a table "Telephone Calls" where we log phone calls throughout the day. I also have a table "Correspondence" that logs each correspondence sent. I now want to see a summary of say the last few weeks (Date1 - Date N) of the number of phone calls and correpondence sent for each ...more >>

Getting the greater Date
Posted by Gerry Viator at 7/17/2003 3:38:52 PM
Hi all, How do I get the date that is the greater of the ones listed in the Column called MyDate and is a datetime datatype. like 2002-05-12 2002-03-08 2002-01-08 2002-01-03 2003-06-12 so the greater date is 2003-06-12 thanks Gerry ...more >>

SELECT - Number of days between records
Posted by Paul Roy at 7/17/2003 3:21:58 PM
Greetings, I need some assistance writing a SELECT statement that will return the number of days elapsed between records in a table with a Transaction Date field. I need to calculate the Days column as shown below: FMTransID GLTransID TransDate TransAmount **Days** --...more >>

new proc
Posted by alex ivascu at 7/17/2003 3:21:23 PM
i am passing in a @vi_date and @vi_qty. i want the insert to loop for as many times as the @vi_qty specifies. thought this would work, but it's not :( at the same time - do a check that if the sql_date is null, assign it the one that i get from the select query. thanks for any assistance. ...more >>

SUM() question
Posted by Derek Ruesch at 7/17/2003 2:46:53 PM
I have the following table tbl1 Name Amount AddTogether Tom 40 0 Steve 10 1 Steve 15 1 Steve 20 1 Simon 25 0 Simon 30 1 Simon 35 1 Wayne 5 0 Wayne 10 0 I want to write a SELECT query that wil...more >>

ADO and Unicode strings
Posted by Yubo Fan at 7/17/2003 1:37:41 PM
I am using ADO in C++ to query a Sql Server table that has an NVARCHAR column. When I have Chinese characters in the column, the variant I get from ADO Field::Value property contains a BSTR with "????". When I looked into the memory of the BSTR, the characters do say "3F 00". Is ADO changing t...more >>

how do you find out getdate() from a linked server
Posted by Mike at 7/17/2003 1:27:15 PM
Hi, How do I get getdate() information from another server? I am in server A, but I want to find out Server B's time. ...more >>

About percentages
Posted by Ed at 7/17/2003 1:24:28 PM
I have a table as follows: UserID BrowserType 1 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) 2 Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) 3 Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) 4 Mozilla/4.0 (compat...more >>

WHERE, AND and wildcards
Posted by shank at 7/17/2003 12:11:45 PM
I'm having problems with using AND in the WHERE clause. In my ASP code, I have the following for each variable in the SP. <% Dim rsSongs__Title rsSongs__Title = "%" If (Request.Querystring("Title") <> "") Then rsSongs__Title = Request.Querystring("Title") End If %> The SP works if I p...more >>

retrieve deleted records for a specici userid
Posted by Patrick at 7/17/2003 11:42:50 AM
Hi Freinds, I have a database used by 40 users in a NT domain. I doing Data backup evey day at 18:00 and doing log backup every hour Here is the situation : One of the users <mydomain\username> deleted some records about 20 min ago and I have to retrieve those back. How can I do that???? the ...more >>

is there anything wrong w/ this proc?
Posted by alex ivascu at 7/17/2003 11:37:06 AM
all i'm doing is creating a procedure, that will pass another parameter to a bigger procedure. it seems that it finds the value of @v_org_id only once, and it inserts all the 864 rows that it should. but after, it does this, the transaction keeps running - with no additional rows being added. ...more >>

Generate results based on another collection of results? (users and zip codes)
Posted by jeffyjones NO[at]SPAM hotmail.com at 7/17/2003 11:33:34 AM
I apologize for asking this, because I know I've seen it before but Google is letting me down. I have a query that gets a list of zip codes within a certain area. That works fine. Now how do I get records from another table (users) that have one of the zip codes from the first result set? If I...more >>

Returning result set from function to stored procedure is very slooooooooow
Posted by Jure at 7/17/2003 11:29:20 AM
Hi ! I'm having strange problem that I'm sure it's trivial for some guru, but after few hours I just cannot solve it. Here it is: I've created function which is basically parametrized view: based on (lots of) parameters it returns record set of results. Something like this: create functi...more >>

Two levels Summary Report
Posted by LamP at 7/17/2003 11:27:16 AM
I am looking for a query that compute summary of a company and department on the same report. Any suggestion would be helpful. Thanks- Example: code amount branch ---- --------------------- ------ CB 1 SUPP CB 1 SUPP su...more >>

WHERE clause and wildcards
Posted by shank at 7/17/2003 11:25:28 AM
I've got 2 variables and I'm trying to use them with wildcards. I can't seem to get the syntax correct. It worked when I used a similar statement using ASP and dynamic SQL. Somehow, I'm not getting it converted into a stored procedure correctly. @Title varchar(70), @Artist varchar(70), WHE...more >>

Testing a Stored Procedure
Posted by Craig G at 7/17/2003 11:19:27 AM
is there a way to step thru a stored procedure to test it? i have a stored procedure that i call from VB that isnt executing properly it is quite large & takes 8 param's so i can't actually see the problem is there an easy way to test it? Cheers, Craig ...more >>

SQL Statement question
Posted by Tim Bird at 7/17/2003 11:17:44 AM
I need to perform an SQL query a bit like this SELECT * FROM Table ORDER BY ((DateField-AnotherDateField) < GetDate()) Any Ideas how to do this. Trying it in the format above throws a problem because of the <. I think I may have to put some kind of IF or IIF statement in, but how? ...more >>

"Cleanup" function
Posted by Scott Cadreau at 7/17/2003 11:10:13 AM
I posted this question a while ago and got a great solution. Unfortunately, I have lost the code for it. I need to write a function that will accept an alphanumeric column and return it with all the non-numeric characters stripped out. i.e. select cleaner('A786%1') the result should be 786...more >>

Model that handles hierarchical relationships
Posted by Venkat Venkataramanan at 7/17/2003 11:04:32 AM
Does anybody have a good model that works for hierarchical data? I am trying to model a structure that breaks down into resusable groups of basic data elements. The complexity is that the offset is dependent upon the sum of the lengths of prior data elements. For example, look at the...more >>

Identity column
Posted by Frank Cheng at 7/17/2003 10:49:46 AM
Hi all, I am trying to insert value into an identity column. I got an error message something like that ".. can only be specified when a column list is used and IDENTITY_INSERT is ON." and then I tried (in Query Analyzer) Set Identity_Insert MyTable On Go Insert Into MyTable Select *...more >>

rollback doesn't reclaim unique id.
Posted by jwalker NO[at]SPAM xdxinc.com at 7/17/2003 10:43:22 AM
I've created a table with an Identity column, seed = 1, increment = 1. I insert records 1, 2, and 3. As a test on how rollback works with the Identity columns I run the following statement Begin Tran Insert Into myTable (colName) Values (newValue) Rollback Tran If I then do a new insert ...more >>

Compare string case sensitive
Posted by Miroo_news at 7/17/2003 10:26:55 AM
How to compare 2 strings (or fields) in case sensitive manner? I'd like to do it without changing the configuration of whole server. Regards Miroo...more >>

LEN of a TEXT field
Posted by Patrick at 7/17/2003 10:23:51 AM
Hi Freinds, What can I use to find out the len of a text field? LEN(<TEXTFIELD>) is invalid. Thanks in advance, Pat ...more >>

Preventing inserts - dictionary based
Posted by Marin MamiƦ at 7/17/2003 9:25:18 AM
I'm not quite sure the subject is completely correct, but it was the closest one I could come up with. Anyway, I have a bit of a problem, and would like to ask if any of you has any ideas? The problem is that I should prevent inserts in a table if inside inserting values appears any of the ...more >>

using REPLACE
Posted by shank at 7/17/2003 9:24:07 AM
I'm trying to replace a partial string with another string in an SQL field. I'm using Query Analyzer and not having much luck with the following... SELECT Replace(Files,"string one","string two") Files is the field String one is a partial string that I'm replacing with string two What is t...more >>

possible to run a select with an if statement in it?
Posted by Jim Bancroft at 7/17/2003 9:09:15 AM
Is it possible to run a select statement that looks something like the pseudo-select below? select firstname, lastname, (if firstname='john' then 'say hello to johnny' else 'where is john?') as expr1 from mytable My skill with select statements ends at the door of inner joins, so forgive ...more >>

Instalation MSDE
Posted by Frank Dulk at 7/17/2003 9:04:45 AM
When I execute the following instruction OSQL /USA /P presents the following error message: [Microsoft]{ODBC SQL Server Driver][SHARED MEMORY] SQL Server does not exist or access denied. [Microsoft]{ODBC SQL Server Driver] Connectionopen (connect()) Operating system WINDOWS 98 2 Edit...more >>

How to format a field that is use in the COMPUTE clause
Posted by LamP at 7/17/2003 8:57:53 AM
Hi, I am trying to format a INT field into VARCHAR (ex. $2,000.00) that is used in the COMPUTE clause as well. Unfortunately, I cannot use the COMPUTE clause this way. Is there another way out for me? Sample code. I would like to format an amount field. SELECT company, dept, amount FROM...more >>

speed challenge
Posted by JT at 7/17/2003 8:52:47 AM
can anyone help me make this query run faster?? UPDATE tpayment SET status_id = 3, modified_date = getdate(), modified_user_id = @user_id WHERE payment_id = (SELECT MIN(payment_id) FROM tPayment WHERE contract_id = @contract_id ...more >>

Losing uncommitted Data?
Posted by Jen at 7/17/2003 8:39:53 AM
I have attached a copy of a stored procedure which I am using. This stored procedure contains a Begin Tran and a Commit Tran. However, when we call this stored procedure and the connection is unexpectedly terminated all data being added is rolledback. Yet, The EmployeeScheduleId, PK is ...more >>

Alternate execution plans?
Posted by PD at 7/17/2003 8:26:15 AM
We have a stored procedure containing several subqueries. Running this procedure through query analyzer provides instantaneous results. Running the same procedure through an ADO connection from a web application takes several minutes. It appears that SQL Server is using two separate exe...more >>

Linked Server Query Design
Posted by Chris Hoare at 7/17/2003 8:23:25 AM
Hello All, I have a client that needs to have a product installed accross two linked sql servers. (Sadly they are Standard not enterprise so clustering is not an option) One server is a dual processor; and contains the larger database information (9gb); the other is a single processor...more >>

Finding Duplicate Values in a table
Posted by Dan Sullivan at 7/17/2003 8:10:02 AM
Hello, I would like to find only the values in a table that are duplicated (or shown more than once). How can I do this through SQL statement? Thank you, Dan Sullivan...more >>

Adding New SQL Users
Posted by Floyd at 7/17/2003 7:55:15 AM
I would like to create an interface in VB that allows the user to add a SQL user. Is there any documentation out there that might help me with this? I'm sure there are some stored procedures that I can use to add/edit users... Thanks, Floyd...more >>

Selecting results from a Stored Procedure
Posted by Steve at 7/17/2003 7:54:25 AM
All, Once again thanks for your help! - SQL Server 2000 I have a situation where I am wanting to look at scheduled jobs currently running on a server. To do this I am using sp_help_jobs. My aim is to be able to select the scheduled jobs that are currently running and compare the length o...more >>

Multi table queries with agregates
Posted by JoeProgrammer at 7/17/2003 6:13:08 AM
I have a master part list table and a in stock table with an entry for each part. I want a result set from the master table with a count for the parts in the stock table. I tried this query: select m.Part_no, m.Man, m.Model_Application, m.Years, m.Disp, m.description, m.catalog_comments, m.st...more >>

SQlL Sum Query
Posted by Peter Newman at 7/17/2003 5:54:30 AM
I am trying to do a complicated count query and need some assistance Table 1 contains a the nomanal codes and discriptions of our account types ( approx 40 records ) Table 2 contains all the transactions recieved from our customers. select * from Table1 a, Table2 b where (b.ACCY...more >>

impementing a complex sequence
Posted by jason at 7/17/2003 4:44:32 AM
I have a sequence A1 to A99, B1 to B99, etc.. I'd like to do Select NextVal from MySequence and doing this would return the value in the sequence and update the sequence. Is it possible? I'd like to hear people's experience with this....more >>

Query
Posted by Wayde at 7/17/2003 3:31:24 AM
Sample data is: Name Date Cost Computer1 25/02/2003 1913.35 Computer2 28/03/2003 969.38 Computer3 04/07/2003 900.00 Results should be: For year end 30/06/2003 Name Date Cost NewValue Computer1 25/02/2003 1913.35 1276 Computer2 28/03/2003 969.38 64...more >>

Dynamically building up a WHERE clause
Posted by Beverley Brindle at 7/17/2003 3:07:37 AM
I'm relativley new to SQL Server 2000 DB's, and come from an Oracle background. I need to dynamically produce the WHERE clause dependent on parameters being passed into a stored procedure. Can I do this? If so, how?...more >>

Monitoring Structure Databases
Posted by Peter at 7/17/2003 2:08:30 AM
Dear All, We have a system with a development database, 7 programmers and myself. As our deadlines are tight the programmers can make changes to the development database, however sometimes they do not tell me, and the creation of the test database fails. I was wondering then if there w...more >>

SP with unknown number of arguments or one delimited argument
Posted by Ray at <%=sLocation% at 7/17/2003 12:11:11 AM
Hi group, SQL 2000: Can anyone tell me how to create a stored procedure that will either accept an unknown number of arguments or that can accept a comma separated argument interpreted as just a single argument so that I can use an IN in my WHERE clause? Example: CREATE PROCEDURE sp_Somet...more >>


DevelopmentNow Blog