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 2007 > threads for wednesday april 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

Four tables (dbf files) problem with JOIN
Posted by tzaryoush NO[at]SPAM gmail.com at 4/18/2007 11:52:30 PM
Hi i've got one table which have two columns: ------------------------------------------- | NumberKON | NameKon | | | | ------------------------------------------- and three same tables each for every month - january, february, march --------------...more >>


Evalute formula string
Posted by don at 4/18/2007 9:51:12 PM
Hi everyone, Is there anyway that i can evaluate the value from string which contains my formula? Sample Code : declare @principal decimal(11,2), @interest decimal(11,2), @interest_formula varchar(1000) set @interest_formula = '@principal * .20 --can i do this? set @p...more >>

DISTINCT vs GROUP BY with multiple columns
Posted by Thanh Nguyen at 4/18/2007 9:42:25 PM
Hi Experts, I'm not sure if I miss anything here, but I've been scratching my head for hours here for simple problem, not able to figure out what's wrong. Here's my scenario: My trouble tikcet table contain doctor profiles which has duplicates, I would like to select out all the rows that ...more >>

Union Grouping across multiple tables
Posted by Rico at 4/18/2007 7:43:35 PM
Hello, I'm creating a union query that returns the ClientIDs that fit a certain criteria across three separate tables (appointments, labs and schedules). Right now when I try to group by each table, I get multiple client IDs if a client has a record in more than one table. For instance; ...more >>

copy a view with new name
Posted by gv at 4/18/2007 7:23:15 PM
Hi all, In query analyser how can I make a copy of a view with a new name? thanks gv ...more >>

getting row count of three different queries..
Posted by kyong at 4/18/2007 5:46:01 PM
hello.. wanted to know how to solve this little query in a cleaner way.. Problem: have to query three different tables and get a row count of the result ( actualy i have lots of issues.. ;) ) Solution: i did this.. (1) create a temp table (2) insert into x query ...more >>

Basic question
Posted by Robert Dufour at 4/18/2007 5:43:00 PM
I am usually concerned just with having databases and in them tables , views, stored procs, etc... What is the use of the notion of projects in SQL 2005, why are they used, how are they useful? Sorry if this sounds dumb but I don't see it. Any insight would be appreciated. Bob ...more >>

SELECT Multiplicate rows : SELECT X times same record where X is a value in some column
Posted by Kristof Clevers at 4/18/2007 4:20:48 PM
Hey, To explain I will give an example: Let's say I have a table like this: | PK | XTimes | | 1 | 3 | | 2 | 1 | | 3 | 2 | No from this data I want to write some kind of select query so it will return me: PK 1 1 1 2 3 3 So I want to ...more >>



is temp table present in db
Posted by John Grandy at 4/18/2007 3:57:40 PM
How to determine if a local temporary table '#TempTable' is present in a database ? ...more >>

Same Query, Same Server, Same User, Different Plan
Posted by JMass at 4/18/2007 2:20:02 PM
SQL 2000 IA 64. I have a query that I execute in QA, it uses a newly created index (seek) and returns rather quickly from a table with over 15 million rows. I put that query into DTS, inside an Execute SQL Task, and an old index is scanned. If I put the query into an Agent job, the same...more >>

DISTINCT Clause Problems - Urgent.. Helps needed
Posted by portCo at 4/18/2007 2:10:28 PM
Hi there, I have four tables which are linked. When I tried to retrieved the data using Inner Join method with those four tables it gave me some duplicate data as well. So, I used "DISTINCT" clause. However, still I have some duplicate rows. Here is my code. Thanks in advance for your helps....more >>

BeginExecuteNonQuery IAsyncResult is signalling before cmd complet
Posted by Ed at 4/18/2007 1:10:01 PM
I am calling a stored procedure asynchronously using SqlCommand.BeginExecutNonQuery. My problem is that the IAsyncResult is signalling before the procedure is complete. The call to IAsyncResult.WaitOne(), blocks for a while, but when it does return, my next call to EndExecuteNonQuery bloc...more >>

DELETE and UPDATE query on linked server
Posted by Sonny at 4/18/2007 1:02:28 PM
Hi all, Got a question regarding to the linked server. How DELETE and UPDATE query be executed over the linked server. The syntax I am using as following DELETE FROM OPENQUERY(LSERVER, 'Select * From some_table') Does that mean a selection is done on remote server (LSERVER in this case...more >>

Left outer join v. Union
Posted by mGracz at 4/18/2007 12:55:41 PM
Hello everyone, I wonder how we can optimize following query: SELECT a.a,a.b,a.c FROM tab1 a LEFT OUTER JOIN tab2 b ON (a.quantity <0 AND b.pid = a.id) OR (a.quantity>=0 and b.rid = a.id) without losing any rows. If we have query like this: SELECT a.a,a.b,a.c FROM tab1 a JOIN t...more >>

Blocking/Blocked SPIDs
Posted by Leon Shargorodsky at 4/18/2007 12:46:03 PM
What does it mean when sysprocesses.spid and sysprocesses.blocked show the same SPID? I have always thought that "blocked" represents a blocking process, while "spid" represents a victim....more >>

Retrieve rows from un-Normalized table - ?
Posted by Rich at 4/18/2007 12:40:01 PM
I have a legacy table - unNormalized - that contains legacy data that I need to look at. I need to return rows where any of 16 columns contains data - call these col1, col2, ...col16 Right now I am inserting rows into a Collection table one column at a time Insert Into tblCollection Sele...more >>

Security issue with DecryptByCert function in sql 05
Posted by Losing my composure at 4/18/2007 12:16:12 PM
Sorry for the long post, I'll try to be as detailed as possible. My app is supposed to run in an occasionally disconnected environment with SqlCE to cache data which is syncronized at intervals. I thought it would be wise to use a certificate encryption scheme to allow the cleint to encryp...more >>

Formating Datediff results
Posted by gv at 4/18/2007 12:05:20 PM
Hi all, using SQL 2000 sp4 Trying to format the duration DECLARE @timestart DATETIME DECLARE @timeend DATETIME SET @timestart = '2007-04-13 14:25:54.267' SET @timeend = '2007-04-13 15:39:54.267' --Query is wrong : SELECT DATEDIFF(ss,@timestart,@timeend) / 60.0 AS Duration --...more >>

Transaction log Job
Posted by FARRUKH at 4/18/2007 11:28:02 AM
I set the transactional log job. it takes transactional log backup everynight and delete the previous backup(TRN) file. The problem is it takes backup successfully but doesn't delete previous backup file. there is no error number and message n logfile. it also shows Job failed n Job history me...more >>

to find if servername exist or not
Posted by Ken at 4/18/2007 11:11:35 AM
is there a query to find if a servername exists or not? for example server is "sqltestserver" Thanks ...more >>

CLR stored procedures and garbage collection
Posted by sqlboy2000 at 4/18/2007 10:24:33 AM
Can anyone explain how garbage collection works in the SQL CLR? I'm disposing of all my objects, but it never appears to release the memory right away. I've read where it only runs garbage collection when resources reach a certain limit. But that doesn't seem right to me. If you are close to t...more >>

SQL insert issue
Posted by Daniel at 4/18/2007 10:18:11 AM
Not sure if its an issue on the server side or my web page side.. but would like to see if anyone can shed some light on this. Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]Parameterized Query '(@P1 text,@P2 nvarchar(50),@P3 nvarcha...more >>

FTP quetion
Posted by sl at 4/18/2007 10:12:03 AM
Hi I need to FTP a file from HP3000 to SQL 2005 server. How do I setup a user account in SQL server side to enable the FTP process from HP3000. I have the code as below: !BUILD FTPXEQT.PUB.SYS;REC=-2,128,F,ASCII;DISC=1 !ftp 111.11.111.11 --> <SQL ip> user anony...more >>

Backup Query
Posted by brymer28303 at 4/18/2007 9:47:44 AM
I have written the following query to identity all the databases on a server and the last full backup date time within the last 24 hours. I need to see any new databases that are added to server, even if they have not been backed up yet. I tried to use a sub query but, I'm having a HUGE brai...more >>

How to: Converting a uniqueidentifier to an integer...
Posted by Roz at 4/18/2007 9:28:02 AM
Hello, all. Using SQL 2K5. I have a table (Table A) with a uniqueidentifier field that I've got to import into another table (Table B). The field on Table B is an integer, and I can't change the datatype since the table belongs to an off the shelf purchased database & application. So my qu...more >>

Convert varbinary into varchar
Posted by Matthew at 4/18/2007 9:21:26 AM
This should be simple, but for some reason it have me stumped. DECLARE @guest varchar(85) SELECT CAST(CAST(@guest AS varbinary(85)) AS varchar(85)) --SELECT CONVERT(varchar(85), CONVERT(varbinary(85), @guest)) --SELECT @guest = sid FROM master.dbo.sysusers WHERE name = 'guest' PRINT @g...more >>

Simple Aggregate question
Posted by NewCreature at 4/18/2007 9:21:04 AM
I am trying to write a simple query to give me the first appointment of the day for each provider in our clinic and the procedure to be performed. I have done this before, but can't remember how. Can someone clue me in? Here is an example table in csv format... Appoint table apptDate, apptTim...more >>

Need help with the query
Posted by Ryan at 4/18/2007 9:02:17 AM
CREATE TABLE dbo.ProductDesc( ProdID nvarchar(16) NOT NULL, ProdType nvarchar(2) NOT NULL, ProdNo nvarchar(4) NULL, ProdDescription nvarchar(250) NULL) insert into dbo.Category values('A1', 'V', 1, 'Vegetables') insert into dbo.Category values('A1', 'F', 1, 'Fruits') insert into dbo...more >>

sp_attach_db
Posted by Leon Shargorodsky at 4/18/2007 8:44:41 AM
Is there a workaround when it comes to attaching a DB with more than 16 physical files? SQL Server 2000 allows to create database with 32,767 physical files, yet sp_attach_db allows only 16-file DB to be attached... Thank you in advance for your help! Leon...more >>

Using GROUP BY with correlated subquery
Posted by Tim Zych at 4/18/2007 8:21:58 AM
I have a subquery that seems to work as I want. It's using the financialCalendar table to return the next business day, in conjunction with the date in the TempTable. But, how do I GROUP BY that? If I omit the GROUP BY's t.EndDate, even though I'm not SELECTing t.EndDate, the parser compla...more >>

MS Access Concurrency Error
Posted by Matt Sonic at 4/18/2007 7:32:03 AM
The cause of this problem may be that I change the AllowNulls property of a field from True to False but I don't know how to fix it. Or it may not be. When I try to update a record in a MS Access front end I get a Write Conflict error - copy the changes to the clipboard or drop changes. ...more >>

unresolved external symbol .srv_senddone
Posted by GordonS NO[at]SPAM pilgrimsystems.com at 4/18/2007 6:58:37 AM
Hi, I am trying to build a 64 bit version of an existing extended stored procedure in Visual Studio 6 but I am receiving a bunch of linker errors outlined below. unresolved external symbol .srv_senddone referenced in function .xp_diwor unresolved external symbol .srv_paramlen referenced in...more >>

Database Mirroring Question
Posted by Nitin at 4/18/2007 6:02:04 AM
Can you set up 2 mirrors on One Database in SQL 2005? I would like to mirror 2 instances of the same database to 2 different servers. Has anyone done it in the past? Thanks in advance ...more >>

Capture statistics about Insert and Updates in Stored Procedure
Posted by Devon at 4/18/2007 6:00:01 AM
Hello- I am working on a data warehouse project that uses an ELT strategy for loading a dimensional model. The E extracts the data from source systems and Loads into a staging area and the data table are just replicas of the source system. Next the T uses stored procs to Transform the data into...more >>

ASP ans sql server 2005
Posted by dal.luc NO[at]SPAM gmail.com at 4/18/2007 5:48:45 AM
Hello everyone, I've a (stupid) question. I have a web site in ASP classic /MS Access but I must translate the databases in sqp server express 2005. Is it possible easily without upgrading to ASP.Net ? If it is possible, what are the main limitations ? Thanks for your assistance. ...more >>

Delete from multiple tables...
Posted by trint at 4/18/2007 5:45:37 AM
Is there a better way than this: delete from orders, order_items where orders.id = 12803 and order_items.order_id = 12803 This is to get completely rid of the order in multiple tables (there may be more) Thanks, Trint ...more >>

SP Recompile and Index Weird Problem
Posted by R3al1ty at 4/18/2007 5:35:36 AM
Hi folks, I'm getting some weird behaviour with our SQL Server. We have a very complex SP and a database with 7 indexes and around a million records. 1. Make any change to the SP 2. Execute SP 3. ExecutionTime = 30 secs 4. Execute SP any number of times after that also takes 30 secs 1. ...more >>

SQL SERVER 2000 DBA
Posted by Francis Valan at 4/18/2007 5:14:19 AM
I am new to SQL DB administration. I want to know the things i need to periodically. If any one can send a document regarding this to my email id will help me a lot. My email is "francisgp1@gmail.com" Thanks, A Francis ...more >>

Combinations
Posted by GMid at 4/18/2007 4:03:54 AM
I need function that returns all combinations K elem. from a given set of N elem. Is it posible with sql server, and how? ...more >>

row into column
Posted by Rahul at 4/18/2007 2:41:42 AM
Friends, I have a table with 100+ columns. I have a selection cateria, for which i get only only row from that table. my problem is i want to convert this row into column. how we can do it? ...more >>

What is the N for?
Posted by Ant at 4/18/2007 1:42:03 AM
Hi, I've noticed the letter N preceding some arguments. I've tried looking for the meaning of it in books on line but no luck. Can anybody tell me what this is: select 'X' from myTable where myID=N'79' Thanks vert much for your help Ant...more >>

2005: How to SELECT a Bitmask?
Posted by Andreas Klemt at 4/18/2007 12:10:20 AM
Hello, I have this values: 1 = value_a 2 = value_b 4 = value_c 8 = value_d 16 = value_e Now I add some values like a+b+c = 7 and put it in my table value 7 1 16 How can I select to get the value_b? In VB.NET I do it like this IF value AND value_b THEN .... Thanks for any...more >>

query of a big tabler of 70,000,000 rows
Posted by pelegk1 at 4/18/2007 12:06:04 AM
when i make a "select * table1" on such a big table and then i do it again will i recive the same row order (assuming i didnt use order by,didnt user key/indexe's) and if the order isn't then same then why? (where can i read of the architecture that maybe explain it) and generally how does ...more >>

Recursion in sql server 2005
Posted by Martin at 4/18/2007 12:00:00 AM
Hi, In sql server 2000 there was a limit of 32 on recursive queries. Has this limit changed in sql server 2005? If it hasn't then can it be over-ridden by some setting? what is the best way to handle recurive data (eg nested sets) I read briefly about CTE's but am not sure if this is the wa...more >>

Can this be done with an SQL statement?
Posted by Luc Kumps at 4/18/2007 12:00:00 AM
We have a table with these columns: * ArticleId * Date * Number in stock Given a specific date, we would like to show the number of items in stock for all articles. For example, with these records: 100 Jan 01, 2007 20 100 Jan 02, 2007 30 100 Jan 06, 2007 25 200 Ja...more >>

Can this be done with an SQL statement?
Posted by Luc Kumps at 4/18/2007 12:00:00 AM
We have a table with these columns: * ArticleId ...more >>

What went wrong with my scripts?
Posted by Jason Huang at 4/18/2007 12:00:00 AM
Hi, I have something wrong with my following scripts, would someone give me some suggestion? select * from ContactAddr where CustNo in ( select CustNo, count(*) from ContactAddr group by CustNo having count(*) >2 ) Thanks for help. Jason ...more >>

trigger question
Posted by L.Peter at 4/18/2007 12:00:00 AM
Hi Group, I have a db with three tables, each table has a column called lastwrite (datetime) what is the easiest way to update this coulmn everytime sql update record(s) in these table? I was thinking of: create a store procedure 'proc1' take @tablename then do update @tablename set lastwr...more >>


DevelopmentNow Blog