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 > january 2007 > threads for tuesday january 30

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 do you determine if a field exists?
Posted by Rico at 1/30/2007 11:38:12 PM
Hello, I'm trying to write a script to update a series of tables. Is there any way to determine if a field exists in a particular table? Any direction would be appreicated. Thanks! Rick ...more >>


Profiler results - Update issue
Posted by shenoyvik NO[at]SPAM gmail.com at 1/30/2007 11:10:11 PM
Hi, I have an issue. I am using .net application to connect to the SQL server 2000 through SQLhelper class to update one of my table. I am using a stored procedure to update the table with the output parameter returning back to me a value back. But i am finding that its returning to me only 1...more >>

Scripting data to a file from a table to be inserted into the same table
Posted by yaser at 1/30/2007 10:14:14 PM
Hi all; I have a table contains some initial data and I want to take these data into a file like a script to copy these data into the same table but in another database, I don’t want to use copy data base from server to another, I want the file to be like a script so when ever we run it on ...more >>

Insert Permission in Tables
Posted by Shocky at 1/30/2007 8:55:10 PM
Take a case a where user does not have insert access to a table T1, but user has stored procedure execute access. Can inserts be done to table T1 using the stored procedure? Can user be the owner of table T1 and still insert access can be denied to the user? ...more >>

Using low-level file I/O function in a stored procedure
Posted by Man-wai Chang at 1/30/2007 8:45:18 PM
Are they available? -- .~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org / v \ Simplicity is Beauty! May the Force and Farce be with you! /( _ )\ (Ubuntu 6.10) Linux 2.6.19.2 ^ ^ 20:43:01 up 18 days 23:55 0 users load average: 1.00 1.00 1.00 news://news.3home.net ...more >>

sort by time only in datetime
Posted by CipherTeKST at 1/30/2007 8:34:00 PM
greetings... I have a stored procedure that results with a column of time only, my problem is that when i order by this column the results are: 10:00 AM 11:00 AM 12:00 PM 1:00 PM 2:00 PM 3:00 PM 4:00 PM 5:00 PM 6:00 PM 7:00 PM 8:00 PM 9:00 PM 8:00 AM 9:00 AM I need it to be sorte...more >>

sql stored procedure
Posted by rev at 1/30/2007 8:17:14 PM
i have a stored procedure which selects a record from a table based on id . i have to check if the record exixsts in the table before selecting the record: this is my code: reate procedure seltimesheet @timesheetid uniqueidentifier as if exists ( select * from Timesheet where TimesheetId =...more >>

[SQL Server 2000] TRUNCATE TABLE
Posted by Man-wai Chang at 1/30/2007 8:11:53 PM
Is there a way for a non-sa user to run TRUNCATE TABLE? -- .~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org / v \ Simplicity is Beauty! May the Force and Farce be with you! /( _ )\ (Ubuntu 6.10) Linux 2.6.19.2 ^ ^ 20:10:01 up 18 days 23:22 0 users load average: 1....more >>



Calling a web service in SQL2K
Posted by ekkis at 1/30/2007 6:56:00 PM
I've isntalled the SOAP Toolkit on a SQL Server 2000 box (see: http://tinyurl.com/aw2o) and am trying to invoke a web service from a stored procedure. I have been successful in retrieving simple datatype values (from calls to GetInteger and GetString) but when the returned value is not simp...more >>

How to select the rows from 10-20?
Posted by Cylix at 1/30/2007 5:52:22 PM
In MYSQL SQL, I know there is a LIMIT can be use to do so, is it any syntax in MS SQL? I would like to select the rows rom 10-20 out of 100 rows record. This table has a primary identity key named rowID with some missing key, let say, 12 and 16 row is delete. Thanks! ...more >>

How to calculate space used by user?
Posted by brett at 1/30/2007 4:52:52 PM
I'd like to keep track of the space being used in MSSQL 2005 for each user. freshbooks.com does this for the invoicing service and displays it to users. The first thing is to figure out what exactly I want to track. Once I know that, what is the best way to calculate an "x MB of x MB used...more >>

Fast in Access / Slow in SQL 2005
Posted by Rick001 at 1/30/2007 4:31:01 PM
I am importing about 60,000 records from a text file. As each record is read, it is inserted into a table "TImport" via a recordset. In MS Access this is completed in about 15 seconds. We changed the database to SQL 2005 with identical tables and now this read/insert process (60,000x) is t...more >>

Question on the partition function
Posted by BYU at 1/30/2007 4:01:01 PM
I'm confused on the range definition in a partition function. Lets say I want to create monthly partition starting from Jan 2007, how many values should I put in the range? 12 months per year and for 2 years that will be 24 values? What happens when the third year starts? Do I need to manu...more >>

Whats the Difference Between an Index Enforcing Uniquiness and a Unique Constraint
Posted by Simon Harvey at 1/30/2007 3:18:09 PM
Hi all, Can anyone tell me what the difference is between adding a unique constraint to a column, and adding a new index that is marked as unique? As I understand it, adding a unique constraint has the effect of adding a unique index anyway to enforce the constraint. If this is the case, ...more >>

How to convert CSV string to quoted values?
Posted by Jasolution at 1/30/2007 3:06:52 PM
I'm passing a comma separated string into a stored procedure as the @Zips varchar(255) variable. It holds a string of zip codes like this: 90201,90333,90455 that I need to use in a query like this: .....AND c.zip IN ('90201','90333','90455') What is the best way to convert my CSV strin...more >>

How doo we do this with SQL 2000
Posted by DBA at 1/30/2007 3:06:00 PM
http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/storage-top-10.mspx...more >>

user defined function usage?
Posted by rick_mc at 1/30/2007 3:04:01 PM
Hello, I'm new to SQL Derver stored procs. I came across this syntax and can't find it in the online reference. I assume it is a call to a user defined function and was hoping someone could point me to the docs... {fn GET_TIME}...more >>

best practices on a query
Posted by Brian at 1/30/2007 2:51:00 PM
I have a table that has the following characteristics. ItemName key value item1 100 0.4 item1 200 0.5 item1 300 0.7 item2 300 0.6 item3 500 1.9 item2 100 1.1 item3 100 2.2 and i need an output table such as the following: k...more >>

Moving database logins
Posted by Sammy at 1/30/2007 2:39:01 PM
Hi I am looking at the MS script sp_help_revlogin but I'd like to know to encounter less problems, when mvoing a database onto a new server to ensure the logins work correctly. Should you add the logins first then move the database on the new server or is it better to move the database fir...more >>

Need help with SQL Join Query
Posted by RandyGoogle at 1/30/2007 2:02:47 PM
I have two tables reps tid smallint(3) auto_increment initials char(4) ( Rep Initials) areacode int(3) (Area Codes for all the States) state char(2) (State Area Code Resi...more >>

in vs exists
Posted by Carly at 1/30/2007 1:56:25 PM
Hi What would be the difference between using in and using exists with a subquery. Thanks, Carly ...more >>

problem on backing up log file
Posted by Roy Goldhammer at 1/30/2007 1:44:36 PM
Hello there I have database maintenance plan who backup the file i'm working with and it brings me an error: Backup can not be performed on database 'my database' and don't show error and reason for that. what can cause the log file not to be backing up? ...more >>

Newbie-how to copy table from SQL 2000 to 2005
Posted by Coop at 1/30/2007 1:41:01 PM
Hi. I need to copy an existing table from a SQL 2000 server to an existing database on a SQL 2005 server so another application can access it. I suppose there are a number of methods to accomplish this. I created a linked server on the SQL 2005 box, but not sure where to go from there. Any...more >>

FORMAT argument in BCP
Posted by Rick Charnes at 1/30/2007 1:27:45 PM
Hi -- I'm confused about BCP's FORMAT argument, which I'd like to use to create a format file for future BCP runs. I see that the syntax is: FORMAT [datafile] and that it needs to be used with -f: -f [format_file] Yet here I'm only executing BCP to *create* a format file to use in the...more >>

Difference between SQL Server 2005 and Sqlserver2000
Posted by CharLi Solutions at 1/30/2007 1:04:25 PM
Hi All, What is the difference between SQLSEVER 2005 and SQLSERVER 2000. Thanks Chellam ...more >>

JDBC authentication having hostname\xxx format
Posted by Arup at 1/30/2007 12:47:17 PM
Hi I am using sqldbc.jar to access SQL Server my code was working fine till the db server name was one singlr hostname now the DBA has changed it to HOSTNAME\XXXX format and my java code is failing. The following URL is what is getting generated. jdbc:sqlserver://HOSTNAME\XXXX:1433;database...more >>

SQL 2000, VBScript Error in Job Step, Object variable not set: 'CreateObject'
Posted by jwbutler via SQLMonster.com at 1/30/2007 12:08:10 PM
I am receiving the following error; Error Source= Microsoft VBScript runtime error Error Description: Object variable not set: 'CreateObject' when the following active x script job step executes; sub main() set Messanger = CreateObject("eFAACTMessanger.clseFAACTMessanger") Messang...more >>

return all records
Posted by led at 1/30/2007 11:57:08 AM
hi i have 3 listboxs used like search criteria. the default option is all records. it works on nvarchar fields with % , but doen'st with INT fields. How can i do that for INT fields?? thanks in advance ...more >>

block Bulk insert
Posted by Carly at 1/30/2007 11:02:45 AM
Hi, I was asked at a job interview to create a trigger that will block the bulk insert in a table. I HAVE NO IDEA OF HOW TO BLOCK BULK INSERT!! Any ideas? Thanks, Carly ...more >>

Query Performance
Posted by bradrj101 at 1/30/2007 11:00:00 AM
I have 2 SQL Servers running the same query from a linked server. With the linked servers set up the same as far as I can tell. Both use OLEDB for SQL Server. On one server I am running SP3 and the other I am running SP4 The issue is that on the server with SP3 I run the query below and ...more >>

Group By and Count
Posted by at 1/30/2007 10:49:51 AM
custid, date_logged_in 123, 1/1/2007 234, 1/1/2007 123, 1/1/2007 123, 1/1/2007 567, 1/1/2007 567, 1/2/2007 789, 1/2/2007 I only need to know that a custid logged in once per day. How would I get this count by time frame? E.g. the query for timeframe 2/2/2006 to 3/3/2008 would produce...more >>

column name as variable
Posted by nkg at 1/30/2007 10:17:12 AM
script ========= create table t1(id int identity(1,1),[1] int ,[2] int) go insert into t1([1],[2]) values(1,1) go insert into t1([1],[2]) values(1,2) go insert into t1([1],[2]) values(2,3) go select [1],[2] from t1 where "1" =1 --returns 2 rows is it possible to write a similar se...more >>

Random function value as default table field value
Posted by Per Bylund at 1/30/2007 10:10:02 AM
I have written a user defined function (UDF) that makes a random whole number with 1-15 digits. The intended use of this function is to provide a randomized field in a table with more than ten million records: I will need to use SELECT commands based on a number of WHERE clauses and then pick ...more >>

add a clustered index or not?
Posted by Derek at 1/30/2007 9:47:58 AM
I have a highly volatile table that gets data inserted into it constantly. it currently does not have a clustered index on it because of this. a colleague suggested adding a clustered index on the primary key to improve performance. i'm not sure how this would help.....anybody have an opi...more >>

Dealing with sequential record bins
Posted by Bill at 1/30/2007 9:40:02 AM
I have a table that lists data in unique 'bins' for my customers. There are multiple customers and each one has bins numbered 1-254 They MUST be numbered such. The bin number itself has no meaning - other than being unique for the customer. I can add a record for a customer by setting th...more >>

Criteria on INNER JOIN vs. WHERE
Posted by Mats Hansson at 1/30/2007 9:12:41 AM
Hi, What is most efficient: SELECT * FROM Company a INNER JOIN Store s ON a.companyID = s.companyID INNER JOIN Department d ON s.storeID = d.storeID WHERE d.type = 'A' or this one: SELECT * FROM Company a INNER JOIN Store s ON a.companyID = s.co...more >>

Combining varchar fields
Posted by David at 1/30/2007 8:56:34 AM
I want to combine three name fields in a select statement. name1 name2 name3 name1 name2 name3 --------- ---------- ---------- some owner name owner NULL NULL If I do SELECT (name1 + ' ' + name2 + ' ' + name3) as name, I will get NULL for the value of na...more >>

Alternative ordering for SMO objects
Posted by Ben Thul at 1/30/2007 8:32:14 AM
I'm trying to write a program in C# that utilizes the SMO to do some automated index rebuilds. One thing that I'd like to be able to do is order the tables within a given database by size so that I can do smaller tables first (presumably freeing up space in the database to do rebuilds for l...more >>

Stored Procedure takes waaaaay too long to run
Posted by Trevisc at 1/30/2007 8:23:50 AM
Good morning everyone. I inherited this stored procedure and have been tasked with tweaking it. Its purpose is basically to go back to the beginning of time and recalculate the balance (Credit - Debit) per day for a business. There are essentially 740,000 records in this table, 200,000 a...more >>

Trim trailing white space off a string field
Posted by Emily at 1/30/2007 8:18:41 AM
Hi, I have a string field, "Description", in a database table, "Account", (in SQL Server 2000) that contains an invisible trailing newline character. I was thinking of running an update statement like the follows to trim off the trailing newline character: Update Account Set [Descriptio...more >>

Retrieving single text block from multiple records
Posted by GW at 1/30/2007 6:46:13 AM
I have a simple table that contains phone numbers for contacts. There is a column in the table that contains a fully-formatted text version of the complete phone number (i.e. "(423) 555-1212 Ext. 123" ). Since a contact can have more than one phone number, there can be several records for ...more >>

CHeck if PK is Identity
Posted by Terry Holland at 1/30/2007 6:19:00 AM
Im trying to write a procedure to return a list of tables in my db where the PK is not an identity column but am getting a bit lost. all help appreciated...more >>

DST Affects or Not [WP]
Posted by WILDPACKET at 1/30/2007 5:56:01 AM
Me running SQL 2000. Want to know if the DST will affect SQL Servers or not? Thank you...more >>

Timestamp based selection problem
Posted by MichalV at 1/30/2007 5:21:59 AM
Hi all, I have the following problem: I am distributing data from DB to clients using my server. To have all up-to-date, all my tables include RecTimeStamp (timestamp) column. Using some time intervals clients are asking for new data based on last remembered timestamp. .NET server selects d...more >>

Finding whether a column contains a formula
Posted by Norbert Meiss at 1/30/2007 5:15:02 AM
I would like to find out via ADO or ADOX (or any other means) whether a certain column of a table contains a formula, and if yes, the text of the formula. I didn't find such a property or field in INFORMATION_SCHEMA.COLUMNS. Any help is appreciated. TIA, Norbert Meiss...more >>

How to Export StoreProcedure Result set in to CSV file
Posted by Liyasker Samraj at 1/30/2007 4:46:01 AM
PROCEDURE [dbo].[pcins_ExportUser] AS BEGIN SELECT * FROM TBL_User END ------------------------ PROCEDURE CalingSP AS BEGIN DECLARE @SQL VARCHAR(2000) DECLARE @DataBase VARCHAR(100) DECLARE @Server SQL_VARIANT DECLARE @Path VARCHAR(200) DECLARE @ExportResult INT...more >>

selecting part of a field for comparison
Posted by NathanG at 1/30/2007 4:28:01 AM
Hi, I need to select part of a field to compare it to another contained in another table. The field is a name John Smith The problem is there is a prefix at the start that varies between two letters and 5. i.e ABLS - JOHN SMITH AS - JOHN SMITH If the prefix was the same I would ...more >>

Obtain affected rows from cascade delete
Posted by pavel.orehov NO[at]SPAM gmail.com at 1/30/2007 12:22:47 AM
Hi, I am using cascade delete foreign key with SQL 2005 Express Edition. The delete works fine and delete all related rows. However I need the list of all affected rows from all cascade delete action to apply this changes in my application. I know that it can be done with triggers or not...more >>

how to compare value of two fileds and based on that insert value into third fileds
Posted by Tradeorganizer at 1/30/2007 12:16:45 AM
Hi, I have a database with table name as test in that i have 6 colums they are name varchar (20) address varchar (20) position varchar (20) nametype1 varchar (20) nametype2 varchar (20) nameval varchar(20) now in the nametype1 and nametype2 there are values like nametype1 ...more >>


DevelopmentNow Blog