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

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

User table naming woes - your thougts?
Posted by Ronald S. Cook at 5/2/2007 11:12:31 PM
If I don't want to put brackets around my table names (that are reserved keywords) every single time I need to reference them in SQL, what are my alternatives? Case in point, a table we wish to name "User": 1) Deal with the brackets and go with [User] -- this would kill me 2) Instead of [U...more >>

Mass "Fake" Insert
Posted by sloan at 5/2/2007 9:50:19 PM
Lets say I have a table Emp EmpID int , LastName varchar(12) , FirstName varchar(12) If I need to mass populate this table with... say.... 1,000,000 rows, what's the quickest way to do this? I am developing a new database, and a top thing on the list is to populate with alot of (like ...more >>

Restore database
Posted by Antony at 5/2/2007 8:56:01 PM
Hi I had a SQL Server database by name Jap.Recently my c drive crashed and i have only jap_data and jap_log files stored in D drive.Can i restore back these files so that i will be able to use them?I had few critical office data and would appreciate a quick help in this regard My Best Antony...more >>

import data
Posted by mikeashields NO[at]SPAM gmail.com at 5/2/2007 8:46:55 PM
I'm basically a database noob hoping to find a shortcut if at all possible. I've created an ER diagram for a site I plan to build and have used that to create the database in MS SQL 2000. Now I want to import various data from (basically) excel spreadsheets (for example, company names from ...more >>

AgentMail Problem (SQL2K)
Posted by Leila at 5/2/2007 6:58:28 PM
Hi, I use Microsoft outlook as MAPI client. On my own computer, when the outlook is open, both SQL Mail and Agent Mail can use the file of mail profile to send email. But on one of client's computer, when outlook is open, it locks the file of profile and both SQL Mail and Agent Mail fail when...more >>

Use database name is select statement
Posted by tshad at 5/2/2007 6:27:58 PM
I was curious about whether is is wise to use the database name in a select statement or Create Procedure such as: SELECT * FROM ft.dbo.theTable SELECT * FROM ft..theTable or CREATE PROCEDURE ft.dbo.GetData CREATE PROCEDURE ft..GetData I was curious as someone had mentioned that was ...more >>

DTS Package
Posted by Daniel at 5/2/2007 6:04:00 PM
SQL2005 Where can i find information on scheduling DTS package within 2005? as well as making sure we have everything setup and configured correctly to create and schedule DTS packages.... ...more >>

Schema Question
Posted by Ed at 5/2/2007 5:38:00 PM
Hi, I created an account called "DBLogin" and used this account to log in and created an database called "DBTesting". and the owner of the database is "DBLogin". Then I found out when I create a schema that is owned by "DBLogin" and it fails. Since the owner of a schema have to be a user...more >>



SQL Server 2000 - general usage data
Posted by B. Chernick at 5/2/2007 4:51:01 PM
We're running SQL Server 2000 and I've suddenly been appointed junior DBA (not my usual job.) Some one refresh my memory. Is there any simple call or sp that would give usage info? By 'usage info' I mean things like how long ago a server or a table was last accessed and by who, etc. Se...more >>

using Replace
Posted by MattIrwin via SQLMonster.com at 5/2/2007 4:08:54 PM
Is there some way of using the replace function in SQL That I can remove two characters. Example: I want to select the description of an Item from one table using the data of another. The one table has the item as ESS753-1/3 and the other has it as ESS75313 with the - and / removed. any ideas? ...more >>

DBCC CHECKIDENT
Posted by gv at 5/2/2007 3:56:35 PM
Hi All, Trying to reset identity column, meaning starting with row 1 I want to redo the numbering. I tried this but doesn't DBCC CHECKIDENT (MyTable, RESEED, 1) there is 3 rows and under column id column it is. 1 2 5 I want them to be 1 2 3 thanks gv ...more >>

strange lock
Posted by Awi Ktir at 5/2/2007 3:34:36 PM
I have an SP that creates 3 table varialbes the first one gets filled from a big query that join 5 big tables and it will have up to 2000 rows . the second one is filled by joining the first one to huge tables. the third one is just some aggregation to the second one. all tables in every sel...more >>

Dynamically select rows from any table for manipulation and insert
Posted by Sammy at 5/2/2007 2:54:01 PM
Hi I want to be able to dynamically select the fields from any table. I cannot get this to return all the fields This will be a part of a much larger query which inserts data into certain tables, but I don't know the syntax to return all the fields. I have this below but does not do the job. ...more >>

osql hangs when called from trigger
Posted by Byron at 5/2/2007 2:25:00 PM
Microsoft SQL Server 2000 Service Pack 4. I have been experiencing problems with osql when called from a trigger. The osql command is used with an input .sql file. I think I have narrowed it down to the point where when I declare a variable of type nvarchar. The only way to recover is to...more >>

Display table, column attributes
Posted by wnfisba at 5/2/2007 1:59:02 PM
Ok...stupid question... How can I query a table and produce output disclosing the column names and their attributes??? I need for documentation purposes. Thanks in advance!...more >>

Error -2147467259 executing SP
Posted by Saga at 5/2/2007 12:45:51 PM
Using VB6, SP5 & SQL Server 2000 In VB6 I am sending this line to SQL Server:: exec TXSET_METERDATA 'CS6',Null,Null,'TYPEA',0,'2007-05-01',@Errors3 output This is part of a process that runs every day and has been doing ok until today, and only for one Tag_Id which is the "CS6". The Null...more >>

Remove last two chars from string
Posted by Hitesh at 5/2/2007 12:37:30 PM
Hi, I have a strings like ABCXY, ABCD, XYZAB, XZYA I want to remove last two chars.. I am trying something like .. SELECT REPLACE ('ABCXY', ' ', RIGHT ('ABCXY', 2)) but it is not working.. Also that one has a problem if string is like XYXY... Any hints? hj ...more >>

Application with SQL Server Express DB, doesn't work with SQL Server Options
Posted by Zenon at 5/2/2007 12:16:31 PM
Hi, I have inherited a C# application developed in VS 2005 and SQL Server Express. Since we want to deliver the app with the full version of SQL Server, I am attempting to run it on my development machine which has VS 2005 and SQL Server 2005 but no Express edition. It will not compile, a...more >>

A dumb question
Posted by Jason Cann at 5/2/2007 11:22:58 AM
I know this is a very dumb question but I am unable to find the answer anywhere. And would really appreciate any help. I need to update some data with a "=C4=85" character in it. However, when I update the data it replaces the "=C4=85" with an "a". How do I update the value while maintaining t...more >>

Last value from a group
Posted by Willo at 5/2/2007 10:22:58 AM
Hi; i have this table; id account currentbalance 33 45802 542 34 78299 400 35 78299 330 36 45802 100 37 45802 221 i need to get the "last" currentbalance of each account, so for th...more >>

Non Clustered Primary Key question
Posted by Liz at 5/2/2007 10:09:02 AM
Can someone explain to me why you'd want to use a NonClustered Primary key on a table? Keep in mind the table doesn't have a Clustered index at all or any other NonClustered indexes. I am working with a new application that contains 4 tables non of which have a clustered index. I've never seen...more >>

sql_variant as a class or a structure holder
Posted by WebBuilder451 at 5/2/2007 9:07:02 AM
Not that this is a great thing to be using, perhaps ever, but i'm wondering if any one here has attempted this. Storing a structure or a class in a type of variant? There are times that you just can't go back and do things right, at least not without a lot of money. Hence the use (not need) of...more >>

Select from a group based on greatest date
Posted by dwopffl NO[at]SPAM yahoo.com at 5/2/2007 8:15:13 AM
I need some query help I have the following table ENTITY ID ENC # DATE 1044 101 05/02/2007 1044 101 05/01/2007 1044 101 04/30/2007 1044 102...more >>

Query Help Needed
Posted by Jeff at 5/2/2007 7:59:01 AM
Need a query which returns a count of the total emails sent from the table EventLogMessageInfo and a count of Policy Failures from table EventLogPolicyFailures where the email is one of the following User1@USA.com User5@USA.com User19@USA.com User25@USA.com The results should look li...more >>

Select permission denied. Error 229
Posted by Emma at 5/2/2007 7:52:02 AM
I created a user in 2005 and gave them datareader access only to a database. Using Management Studio, I am able to log in as the user but when I tried to expand the database folder, I get the following error message. I only want the user to be able to read all the tables in a specific database...more >>

Update statement in SQL Server 2000
Posted by RickSean at 5/2/2007 7:23:00 AM
I have two identical tables; TableA and TableB. Both contain over 100 columns, EmpID is PKEY in both tables. I want to check If the data in EmpSalary has changed in TableA then update each and every column in TableB from TableA. How do I write a query to do it? I don't want to type over a 100...more >>

Update help...
Posted by Rob at 5/2/2007 6:49:01 AM
When I try to run the following Update... UPDATE V SET V.PhoneNumber = i.PhoneNumber FROM Vendor V, [icon_user].TEST_RESULTS i WHERE V.VendorName = i.VendorName AND (V.PhoneNumber IS NULL OR V.PhoneNumber = '') AND V.Province_State = 'MB' .... I get this error: Server: Msg 512, Level 1...more >>

BCP Export
Posted by johndoe NO[at]SPAM email.com at 5/2/2007 6:21:28 AM
I am attempting to export a binary file from my SQL Server 2005 database to a .jpg file. Below are the import and export routines I am using. All is well, except that there appears to be four bytes added to the exported file causing the OS to not recognize the file format. Looking at the file...more >>

How to query a server on a different machine?
Posted by Lasse at 5/2/2007 12:59:14 AM
Hi, I have used a query where I access tables from 2 databases, now these databases are going to reside on different servers and machines but on the same lan. What is the syntax to access the "external" database on a different server and machine? previously I wrote "Select invno from Invoice...more >>

No more lock classes (with repro)
Posted by Tom Ellison at 5/2/2007 12:58:17 AM
Dear friends: I have boiled down my problem to a somewhat minimal repro: ALTER FUNCTION XX() RETURNS @A Table (TType varchar(2), Store varchar(15), Grade varchar(4), TDate datetime, Quantity decimal (11,2)) BEGIN UPDATE @A SET Quantity =3D Quantity + (SELECT A.Quantity - A1.Quantity ...more >>

MS SQL -> Record Insertion "QUEUE"
Posted by Eric Layman at 5/2/2007 12:00:00 AM
Hi everyone. I've a technical query regards to MS SQL 2000. This is a one off unique = case . We have a case here, which the INSERT command is not fully committed. = Its a simple command "INSERT INTO TABLE(BLAH) VALUES('data')" It is not held by any Transactions. It seems that this in...more >>

SQLServer 2005: Query times out...
Posted by Peter at 5/2/2007 12:00:00 AM
The following query that works perfectly fine under SQL Server 8.0 but times out under SQL Server 9.0: SELECT * FROM AP3ProductGroupCompatibility WITH(NOLOCK) WHERE ProductGroupAboveID IN (SELECT ID FROM AP3ProductGroup WITH(NOLOCK) WHERE ID IN (SELECT ProductGroupID FROM AP3ProductGroupPr...more >>

Unique Column Value
Posted by at 5/2/2007 12:00:00 AM
How can I permit only specific values values in a varchar(25) column without the use of lookup table? In column1 i only want to allow values NULL, '', 'Current', or 'Not Current' ...more >>

Calling SQL script from another
Posted by TibX at 5/2/2007 12:00:00 AM
Hi, Is there any way to execute a sql script from inside of another sql script? I have a set of many small script files, which i need to execute in specific sequence. Thanks...more >>

email if record found
Posted by Tony WONG at 5/2/2007 12:00:00 AM
The query result return 0. But the variable @query0 is the query formula (select count...), not the query result. How can i execute the query and assign the result to @query0? then i can activate "IF" condition loop. Thanks a lot. ************************ declare @query0 varchar(10...more >>

SET CONCAT_NULL_YIELDS_NULL OFF
Posted by Rod at 5/2/2007 12:00:00 AM
I'm trying to get a 6.5 database to work properly in sql 2000. There's an SP which concatenates (sometimes) null values with another string. As SQL 2000 handles this proc differently I've added SET CONCAT_NULL_YIELDS_NULL OFF to the sp and it works correctly. An article on MSDN notes that t...more >>


DevelopmentNow Blog