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 > april 2004 > threads for thursday april 15

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

Relationships in Foreign Tables
Posted by Gordon Wallace at 4/15/2004 11:19:51 PM
Hi all, I am trying to create a relationship with a table in another database, but none of the existing mechanisms(data diagrams, etc) seem to let me. Any ideas?:? Thanks, Gordon ...more >>


SQL Query, sorting numbers retrieved from varchar.
Posted by Bjorn_Tore at 4/15/2004 10:56:03 PM
Hi Newbie to SQL 2000, and i'm having a bit of a problem I have a varchar column containing data such as '99 702 556' However when i use the following select to retrieve and sort it, it's sorted alphabetically, instead of numerical -- Star select homedirsiz from dbo.tblhistor where homedirs...more >>

How to issue a select with a where clause to search in all the fields in a table
Posted by Roshan J at 4/15/2004 10:51:04 PM
Hi all Is there any way to give a select in MS SQL server with a where clause covering all the fields in the table ( To search in all the fields Eg : Select * from fAdrBook where <AllFields> = ‘John†I want to know what keyword to use instead of AllFields and how to specify the select and ...more >>

SQL , and removing white spaces, sorting output
Posted by bjorn.tore NO[at]SPAM jakobsen.cc at 4/15/2004 10:46:00 PM
Hi. Newbie to SQL 2000, and i'm having a bit of a problem. I have a varchar column containing data such as '99 702 556'. However when i use the following select to retrieve and sort it, it's sorted alphabetically, instead of numerical. -- Start select homedirsize from dbo.tblhistory whe...more >>

SQL Query Quandry
Posted by Laphan at 4/15/2004 10:18:40 PM
Hi All I know I've got to post my schema, etc, but I think its more of a logic thing than table-specific. If you can imagine how an Excel pivot table would display it, I want all of my sales people listed down the left hand side of my report, all my stock categories listed along the top of ...more >>

Need result layout in a list format
Posted by js at 4/15/2004 9:25:57 PM
I'm trying to generate a mailing label list but the host application has an odd requirement and I'm not sure how to achive this Hopefully this explains: I have two tables: tblCompany --------------- CompanyID {pk} Company Address sample data: 1 | xyz company | 456 anystreet...more >>

Perfomance uptimizing
Posted by \ at 4/15/2004 8:09:07 PM
Hi, How can I "compress" a database and it contents without loosing data or damaging anything? I would like to speed optimize, compress, re-index and so and make a job that runs every month or so... What do you recommend? Thanx! Jakob Denmark ...more >>

Copy database
Posted by \ at 4/15/2004 8:06:40 PM
Hi, How do I copy a complete database, with everything in it, tables, stores procedures etc. to a NEW database (for testing) on the same (local) server? It has to be created on another drive that the default (C:\,,,,,SQL dir)... Meaning translog and data files needs to be places on another lo...more >>



Group and page break a report list
Posted by Kaiser at 4/15/2004 7:36:02 PM
Hi I am creating a report in tabular format using Reporting Service which I need to group and page break by on of the field in the data. However, the group by field is required to display on the page header. But when I do so, the field shows the same value on each page. Can anyone suggest me how t...more >>

Executing Stored Procedure using Parameters in Reporting Services
Posted by Lawrence at 4/15/2004 5:36:01 PM
HI I have a stored procedure that has a parameter. I would like to pass the parameter I have set up in Reporting Services to pass that whenever the SP is being executed. However, I am getting the following error "... Procedure 'sp_GetDate' expects parameter '@Project', which was not supplied." H...more >>

The two million dollar question on distributed programming
Posted by David N at 4/15/2004 3:45:01 PM
Hi All, I have to develop stored procedures that work on a distributed environment with a lot of SQL servers spreading out all over the country. In addition to firewall/security problems, I have to deal with SQL error. First of all, I build a view that query data from all SQL Servers, and...more >>

GROUP BY, Aggregates and Subqueries
Posted by Tek Boy at 4/15/2004 3:44:09 PM
I have the following query, which currently returns an empty set (0 rows) if the WHERE criteria is not met, and 1 row (with a currency value in a single column) if the WHERE clause matches at least one row: ========================= -- This is used as a subquery SELECT MAX(Levels...more >>

GUID
Posted by RickN at 4/15/2004 3:35:46 PM
I have several tables where the primary key is a guid. The tables are ususally accessed to retrieve a single record based on the primary key value. Generally, the guids are created before the record is added vs. using newid(). In this scenario, does it make any sense for the guid primary key to...more >>

Why can't this statement work?
Posted by Artem Kliatchkine at 4/15/2004 3:23:41 PM
Hi All, I have a UDF which returns table, let's say dbo.TableFunc(@id int). The table returned contains ID field. I have another table Item which also contains the field named ID. When I try to use the following query SQL server reports a syntax error. SELECT i.ID FROM Item AS i WHERE ...more >>

Pausing execution of a query
Posted by Mike at 4/15/2004 3:15:43 PM
Is there a way to pause execution of a query and resume it, or set the priority of a query? I have a query that I run periodically, but it's very large and bogs my server down. It's not time sensitive, so I don't care if it takes an hour to run, I just want to make sure my other applications ta...more >>

select database name
Posted by JT at 4/15/2004 3:03:51 PM
how can i select the name of the database i am working with?? i have a stored procedure that needs to select the name of the current database in order for it to execute properly. tia ...more >>

insert from table with IDENTITY_INSERT set to ON
Posted by Dave Slinn at 4/15/2004 2:30:45 PM
I want to insert records from one table (table A) into another table (table B). - Table B contains an IDENTITY column. Table A contains the same columns as Table B. - The Table A column that matches the IDENTITY column in Table B are unique (they do NOT appear in Table B). I wan...more >>

Execute one SP from within another SP
Posted by David Krussow at 4/15/2004 2:22:47 PM
2 Questions below: Suppose I have two stored procedures (spA and spB), and I want to execute spB from within spA. QUESTION 1: What syntax can/should be used? Can I simply put this line in spA? Any better syntax? exec spB @someParam1, @someParam2 QUESTION 2: Is it generally conside...more >>

Diff on a string
Posted by darrin.wilkinson NO[at]SPAM cma.ca at 4/15/2004 2:08:36 PM
Hi, I'm using SQL 2000. I'm looking for a way to compare string values and return the difference between the 2. Eg 1. String 1 I can walk String 2 I can walk to home Return Results to home Eg 2. String 1 Darrin can walk String 2 can walk Return Results Darrin ...more >>

This query takes longer when i Run 2nd times
Posted by Raju at 4/15/2004 1:27:47 PM
Hello all, I have this following query, this takes 3 seconds when I run first time, but when I run 2nd time it takes about 55 seconds. Any thought would be greatly appreciated Select lii.ms_num, lii.pn_parcel_num, lii.co_county From List_info_inactive (nolock) lii, Lis_info_Active ...more >>

Variables in CURSOR SELECT
Posted by Luke Ward at 4/15/2004 1:13:28 PM
Hi All Does anyone know how I can achieve the following in a cursor select... THIS IS MY SELECT - the variables fetch column and table names from other cursors ---------------------------------------------------------------------------- -------------------- Set @SQL = 'SELECT COUNT(' + @...more >>

SQL Server Agent Job - Next Run Time
Posted by taroon at 4/15/2004 12:56:52 PM
Hi, I have a SQL server agent job which is scheduled to run at particular intervals. I have a table which is being updated when this job runs at the scheduled time. The table has a column "NextRunTime", which holds the next run time of the scheduled job. But my problem is that since I am updat...more >>

View Partition
Posted by Reddy at 4/15/2004 12:51:04 PM
I did table Horizontal partitiong and created view on them. Tables are created with check constraints, but when I query the view with check constraint column in where clause, why it is scaning all these tables Thank -Reddy...more >>

disable a trigger on a view?
Posted by Rob at 4/15/2004 12:42:45 PM
Hello All, Curious to know if it is possible to disable a trigger on a view, rather then dropping it? I know it can be done on a table, but, am unsure of the syntax for a view. This works for tables: ALTER TABLE tblOrders DISABLE TRIGGER ins_A1 Thanks in advance, R ...more >>

Row level locking - VB 6.0 - SQL Server 2000, Communication through HTTP
Posted by Peri at 4/15/2004 12:41:37 PM
Hi, My Scenario: I am working on VB 6.0 and SQL server 2000 and the communication between the Front end and the Back end is through HTTP. I am having an ASP page in the server side and executing the query/stored procedure by connecting to this page through a HTTP request. The response to th...more >>

Query Help...
Posted by Dave Karmens at 4/15/2004 12:40:05 PM
I have two tables... One has ad information (pk, adid, title, date, vendor, etc) the other stores what website displays that ad.. (pk, adid, pageid) I'd like to build a query that would return the title, vendor, and total number of time that the ad was displayed.... any help would be most ...more >>

storing HTML in MSSQL
Posted by Dave Karmens at 4/15/2004 12:21:21 PM
What would be the best way to store HTML in MS SQL Server? text, varchar(xx), other?...more >>

CREATE DEFAULT Behavior
Posted by Bruce Murdock at 4/15/2004 12:21:17 PM
SQL Server 2000 with Service Pack 3A. I'm working on a script to update a series of databases. Basically I need to add a series of Tables, UDT's, Defaults and UDF's. Everything was going along fine until I tried: if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DEF_...more >>

Date diff syntax for newbie
Posted by sean at 4/15/2004 12:17:29 PM
HI There, I am relatively new to SQL Server and would like to know how I can only constrain the rows returned from a query when the date is less than 3 days from the current day? Could someone possibly give me a little code snippet? Thanks in advance for your answer Sean ...more >>

cross tab query
Posted by Reza Alirezaei at 4/15/2004 11:50:56 AM
I have got three tabels as below: User: ---------------------- UserID GUID UserName Varchar Study: --------------------- StudyID GUID StudyName Varchar Response: -------------------- ResponseID GUID UserID GUID (Foriegn key to USer) StudyID ...more >>

TSQL
Posted by Chris at 4/15/2004 11:23:03 AM
Is there a tool that will offer suggestions on how to optimize SQL code?...more >>

update comma delimited list
Posted by terry at 4/15/2004 11:12:01 AM
does anyone know how to update a comma delimited list? Thanks Terry...more >>

strings containing quotations
Posted by Kasper Birch Olsen at 4/15/2004 10:50:08 AM
Hi trying to do: declare @myvar varchar (59) set @myvar = (select name from myFirstTable where number=2) exec ('select * from mySecondTable where name = ' + @myvar) --(code is for testing... doesnt really do anyting, but does it in a strange yet interesting way) but I get Invalid c...more >>

DTS fails when run as Job
Posted by Patrick at 4/15/2004 10:46:41 AM
Hi Freinds, SQL 2000 I have a DTS where reads a file from other server: \\server2\uploads\tree.csv When I'm inside the DTS and running it, then everything is fine. Even if I right click on DTS and run , works fine. The problem comes when I schedule the DTS as a job. JOB Fails : INVALID...more >>

oledb out of memory 7933
Posted by bjarup at 4/15/2004 10:31:03 AM
H I am integrating to Oracle 8i from sql7 using linked server. I use openquery in stored procs. I query procedures thar return results fron Oracle. I use oledb provider for odbc. I have a sqljob executing a stored proc once a minute to run the query. I use a cursor to run stored procs that execute...more >>

Alert for high impact queries
Posted by A.M at 4/15/2004 10:25:53 AM
Hi, We are experiencing performance problem because of high impact queries and we would like to be alerted by sql agent upon performance issue. During definition of performance condition alert, which Objects and Counter are the best to monitor high impact queries? Is it possib...more >>

if statement in WHERE clause of SP
Posted by Jon Hinkle at 4/15/2004 10:20:41 AM
I've written a Stored Proc where I pass in 5 variables and I need to write my select statement based on if those variables actually contain values. Something like this: SELECT Field1, Field2 FROM Table1 WHERE Field3 = Variable1 (if Variable2 <> '' AND Field4 = Variable2) (if Va...more >>

Bitwise OR in select statement
Posted by Star at 4/15/2004 10:18:33 AM
Hi I have a query that returns integers, but instead of returning those numbers, I want to return the OR operation for each one of them. For example: MyTable --------- 12 11 100 4 I would need to have function like this (similar to the count(*), sum(..) .... ) Select BitWise(N...more >>

Assign random integer to each record
Posted by Subodh at 4/15/2004 10:13:38 AM
I have the following table: =================== CREATE TABLE Accounts ( AccountID char(5), CONSTRAINT PK_Accounts PRIMARY KEY CLUSTERED (AccountID) ) INSERT INTO Accounts VALUES (AB101) INSERT INTO Accounts VALUES (AB102) INSERT INTO Accounts VALUES (AB103) INSERT INTO Accou...more >>

Execute the results of a query
Posted by Doug Stiers at 4/15/2004 10:05:05 AM
I know there is a procedure that you can call where you pass in a sql statement that builds another sql statement and it executes the resultant sql. Does anyone know the name of that procedure? Thanks, Doug ...more >>

putting in data that does not exist
Posted by M Harding at 4/15/2004 9:47:43 AM
I am trying to get a table of data that has values for some records but puts null values against those that do not exist eg year month gear value 2004 1 1 1 2004 1 2 null 2004 2 1 null 2004 2 2 5 I have the table with all the real values in, ...more >>

Obtaining PWD or UserName from SQL script
Posted by rikesh at 4/15/2004 9:32:59 AM
Hi Is it possible from script to obtain a Username or Password or Authentication settings?? -- Kind Regards Rikesh (SQL2K-SP3/W2K-SP4) ...more >>

SQL resultset output
Posted by Eric D. at 4/15/2004 7:32:42 AM
Hi, Is there a way to directly dump the resultset of a SQL SELECT statement to a text file on a local drive (ie. C:\) TIA, Eric...more >>

QUOTED_IDENTIFIER and SQL DMO
Posted by sandiyan NO[at]SPAM yahoo.co.uk at 4/15/2004 7:14:23 AM
I am trying to dump out scripts for stored procedure and wondering how I could exclude 'SET QUOTED_IDENTIFIER ON/OFF' option from the output. I gather this option becomes part of stored procedure script on creation time...! I couldn't find any flags in SQL DMO that could be used to ignore th...more >>

Converting varbinary to float.
Posted by Kjell Gunnarsson at 4/15/2004 6:04:46 AM
Hello, Does anybody know how to convert an varbinary (that contains a double value written by a C++ application) into a SQL server float ?. This conversion is not supported by the "convert" function. I.e: 1.0 is stored as 0x3FF0000000000000 in a C++ double and SQL server float. Best ...more >>

Can simultaneous acces between Backup and Restore damage BackupLog File?
Posted by Checco at 4/15/2004 5:31:09 AM
I need to know if a simultaneous access between Backup and Restore on the same backup log file can damage the file. I have a server that every 2 minutes backup the transaction log on a file, then another server restore a standby DB, reading the same file. The backup start at even minutes, the restor...more >>

rowcount
Posted by Martin Hellat at 4/15/2004 4:46:04 AM
Good day I have a stored proc that is used for searching customers, i.e. it returns a resultset of customers based on some input parameters. But i need to add functionality that limits the number of rows returned, i.e. returns only first 100 rows. Now, the question is how do i let the user know th...more >>

Calculating simple growth
Posted by Ipswich at 4/15/2004 2:39:19 AM
I'm tossing this question out there to see if anyone has come accross a similar problem. Suppose I have a table that is date sensitive containing Date/Entity/RowValue. I want to build a query that gives me a simple growth calculation from rowvalue1 to rowvalue2 for each Entity using the ...more >>

Joining TF w/o Cursor
Posted by Stephen J Bement at 4/15/2004 2:07:56 AM
CREATE FUNCTION TF ( [id] ) RETURNS @tbl TABLE ( Col1 INT, Col2 DATETIME, ) AS .... CREATE TABLE tbl1 ( [id] INT, [name] VARCHAR(50), [description] VARCHAR(255) ) SELECT * FROM tbl1 JOIN dbo.TF(tbl1....more >>

Dead Lock Error
Posted by San at 4/15/2004 1:46:04 AM
Hi We can able to see some dead lock error in Sql Server Log of Enterprise Manager But users are telling that they don't receive any error. Error Handler were already declared in the application Why its not throwing out any error to the user Pls help us Regards Sa ...more >>

create dynamic query
Posted by Vincenzo at 4/15/2004 1:36:02 AM
I pass some parameters to a stored procedure. I need to build a select query with this parameters to open a cursor. For example I pass the parameters A,B and C. I need to build a query in this form: Select * from MyTable Where A = 1 and B=2 and C=3 with this query I will open the cursor. Like you...more >>

selecting most recent
Posted by syadnasti NO[at]SPAM hotmail.com at 4/15/2004 1:27:44 AM
I need to select the most recent entry for each unique item stored in a table. For the purposes of this posting each item is stored multiple times with a date time stamp. I want to be able to select only the most recent row for each item. So far this is the best I have come up with: SELECT ...more >>

query to distribute money without losing pennies
Posted by Jeff Dee at 4/15/2004 12:21:03 AM
Here's a little problem I'm stuck with tonight. To give a very simple example and synopsis of the problem, I have a large quantity of unrelated pools of money that I need to distribute evenly to people (can anywhere from 1 to 32 people per pool). The solution I'm seeking is how to deal with thos...more >>


DevelopmentNow Blog