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 > april 2004 > threads for tuesday april 13

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

Urgent - A Select statement to rank a column into quartiles
Posted by Pogas at 4/13/2004 10:26:09 PM
Hi, your prompt help in this will be greatly appreciated I have an sql table below with some sample dat Table-FunctionalConten TrustCode OFA FC 5A1 20000 2 RR8 18598 1 RBA 36578 7 5HA ...more >>


Multiuser Problem
Posted by Prabhat at 4/13/2004 9:28:26 PM
How do I lock a particular record that one user has opened for editing? If I use the pessimistic type, can other users view the record (but not edit it) and return a message telling that another person is editing the record, or does this type lock the record such that it is unavailable until t...more >>

Create a constraint
Posted by Niclas Lindblom at 4/13/2004 8:57:24 PM
Hi, Being new to SQL, I need some help with the following situation. I have a linktable that contains a column called TaskID and one called RequestID. I would like to check on each insertion that there is not already a taskID added for the particular RequestID. I.e. it should not be possib...more >>

make columns combination unique
Posted by lanx at 4/13/2004 8:36:03 PM
I have column A , B in a table. Data in both columns could be repeat individually. However, when the combination of A and B should be unique. I tried to make them as a primary key but no success. Any idea could make it happen I am using SQL 2000 standard. Thank you....more >>

First works, second doesn't???
Posted by elb0mb at 4/13/2004 8:11:04 PM
Greetings, I'm having a bit of trouble with getting a query to run. I worked up this first one, which is VERY similiar to what I'm trying to do with the second one(the one that doesn't work). The following query works fine, and generates the results that I'm looking for - I only show it to illus...more >>

Bulk insert performance using ADO.NET?
Posted by John Smith at 4/13/2004 7:03:14 PM
We have been doing some performance testing of bulk inserts (100+ records) using ADO.NET and SQL Server 2000 (default setting) on Win2K3 server. We have found the following: 1) Parameterized queries show no improvement over literal queries 2) Inserts performed in a transaction show a 3x improv...more >>

Slow during INSERT binary data
Posted by Guogang at 4/13/2004 5:54:18 PM
Hi, I have a question about the performance of inserting binary data. I am using SQL 2000, with SP 3A. We do a lot of binary data insert (about 300 files of the size 1M Byte everyday). I discovered that most of the inserts are done smoothly, and quick (no longer than 1 second). But, once ...more >>

Display messages
Posted by dryAriz at 4/13/2004 5:46:02 PM
I'd like to display messages from within stored procedures. are there ways to display message boxe or in a status bar? thanks in advance....more >>



How to get column's data type by SQL command?
Posted by david at 4/13/2004 5:40:33 PM
As Title. Thanks in advance. David ...more >>

synchronize 2 MS-SQL DBs
Posted by manuela niedermaier at 4/13/2004 5:25:33 PM
hi NG! dows anybody knowas a tool or an application which is able to synchronize automatically 2 MS-SQL databases in defined timeslots? i would like to have identical data on both databases. thx lot monika ...more >>

Selecting names starting with number
Posted by crbd98 NO[at]SPAM yahoo.com at 4/13/2004 4:15:30 PM
Hello All, I need help in writing a script to update all the elements on a varchar column that start with a number according to the following example: Original Value Modified value '12abc' 'XX0012abc' '1' 'XX0001' '1234' 'XX1234' 'a...more >>

updating a colum
Posted by JasonMeyer at 4/13/2004 3:27:54 PM
I need to update a colum by multiplying two colums together but how can I make it look through all the rows of my table? With this I can update the particular row: UPDATE VENDORORDERITEMS SET EXTENPRICE = (SELECT SUM(UnitCost * Quantity) FROM VENDORORDERITEMS WHERE VENDORORDERitem...more >>

Trigger status
Posted by Andy at 4/13/2004 3:27:18 PM
How to find out trigger status, i.e. enabled/disabled. TIA ...more >>

Using a WHILE loop on a delimted string
Posted by Dean at 4/13/2004 3:09:09 PM
I'm having trouble with the below listed UserDefinedFunction. When I run this, it seems like the WHILE loop is not working, the function just returns the value that's in the first field of the delimited string: CREATE FUNCTION udf102_ParseField( @argMsg varchar(4000), @argDelimit...more >>

Help!...............................
Posted by tuand2001 NO[at]SPAM yahoo.com at 4/13/2004 2:53:40 PM
Hi All, Is there any sql function or a system SP that I can use to get the creation date of a physical file. Thanks, Tom...more >>

Trigger accessing login
Posted by E Sullivan at 4/13/2004 2:34:23 PM
Hi, Is it possible for a trigger to access the login information for the operating system of the client computer? thanks, Ellie ...more >>

calling sp from another sp
Posted by Reza Alirezaei at 4/13/2004 2:18:48 PM
I want stored procedure A to call stored procedure B, which returns a set of records from a table. Then, I want stored procedure A to perform work on these records. How do I call stored procedure B from within stored procedure A? ...more >>

Procedure Vs. SQL statements
Posted by Aman at 4/13/2004 1:46:03 PM
this sounds really silly but is bothering me to death I have a block of code that I run statement by statement (in query analyser) and it runs under 10 minutes flat (even when there are multiple users running their heavy duty queries). I wrap the same code in a procedure and run it (when I am th...more >>

There Must Be A Set Based Solution - Right?
Posted by Stefan Berglund at 4/13/2004 1:45:21 PM
I have studied this problem and am unable to come up with a set based solution. In light of the frequent remarks in this forum that seem to indicate that a cursor is never needed ~ever~, I'm seeking help in finding a solution that so far has been elusive. The first update statement in the _Up...more >>

Reading User Permissions
Posted by Berny at 4/13/2004 1:41:41 PM
Can someone point me in the right direction? I am trying to turn-off (hide) specific objects on a form based on the current user's permissions (access). I was trying to use the Permissions() function but I can't seem to figure it out. When I use the following in the Query used...more >>

Simple Select statement
Posted by ReidarT at 4/13/2004 1:23:01 PM
I want to list records that starts with Ordernr in a textfield called Varetekst My code is SELECT Varetekst FROM TABLENAME WHERE Varetekst LIKE 'Ordrenr.*' An example of the field Varetekst is Ordrenr. 012344, Ordrenr. 23112 regards reidarT ...more >>

SP_WHO2: what are "sleeping" processes "awaiting command" ?
Posted by Timo at 4/13/2004 1:15:50 PM
I couldn't restore a SQL database on my local development PC and so executed SP_WHO2 based on some tips found online. Not sure, however, how to interpret the results: there seem to be four processes "using" the database, consuming 0 CPU, associated with .Net SqlClient Data Provider, with 01/01 ...more >>

Update Statement. Please Help
Posted by mEmENT0m0RI at 4/13/2004 12:45:40 PM
The update statement doesn't update all the rows matching in the join condition: BEGIN TRANSACTION update GEN SET app_date = tlh_1_745 from datatrac.dbo.gen G INNER join tborrower.dbo.bors B on G.loan_num = B.tlh_1_364 where rtrim(loan_num) <> '' COMMIT TRANSACTION select G.loan_nu...more >>

Stored Proc. advice on passing in criteria.
Posted by Freddie at 4/13/2004 12:37:32 PM
I have a stored procedure which I would like to pass a parameter to filter the final result set. Similar to this. I get an error telling me to pass in the parameter. If I pass in a single name, it works but I'm unable to pass in multiple names. Any advice as to what I'm doing wrong? declare @f...more >>

store & retrieve files
Posted by Alex Wagner at 4/13/2004 12:36:45 PM
Two scenarios: 1. I have to pass files (image or text) from a .NET (C#) app to a SQL2K server. Sql in turn stores some meta information in a table and writes the actual file to disk. 2. I have to retrieve those files from the file system through SQL Requirement is that due to firewall restric...more >>

Views inside Stored procedure
Posted by Louis at 4/13/2004 12:21:05 PM
Below is a stored procedure that contains dbo.Views.O_Closest_to_Now. The View works just fine. However, when I run the stored procedure it is unable to locate the view. What am I doing wrong? CREATE PROCEDURE dbo.O_Fake_Plot AS SELECT ...more >>

Restore to a point in time
Posted by tguillor NO[at]SPAM ems.jsc.nasa.gov at 4/13/2004 12:18:16 PM
SS 2000; see the code below I'm trying to restore to a point in time. I get the message shown below the code. I don't want to load more data, or for the database to be in load state. How do I accomplish that? thanks ============================== RESTORE DATABASE xxxxx FROM disk = 'x:...more >>

How do I remove backslashes from the date in a text field?
Posted by Barbara White at 4/13/2004 12:16:05 PM
How do I remove backslashes from the date in a text field 10/5/1932 1/10/1949 4/19/1984 10/12/1977 10/28/1964 I need them to look like 105193 110194 419198 1012197 1028196 Then, I need to export it to a fixed delimited text file as a 10 character field ...more >>

Syntax Question on Stored Procedure
Posted by newbie04 at 4/13/2004 11:56:04 AM
Hello I have a problem with a stored procedure that accepts three parameters. These parameters are used to query the table. Client can choose to use all three, just two, or one. Getting error on one line in stored procedure (marked with "----"). Errors say either "invalid column name" or "must ...more >>

How can I send an email in different language other than English using SQL Server?
Posted by Raju at 4/13/2004 11:56:01 AM
Hi all, How can I send an email in different language other than English using SQL Server? Thank You Raju ...more >>

Monitoring a Read/Write access to a DB
Posted by moharss NO[at]SPAM auburn.edu at 4/13/2004 11:51:22 AM
Hello, I am trying to write a VB.NET application to do this: 1. Count the number of Read/Write accesses to a DB on the server and, 2. Get the last access time of the DB since its creation. Tried looking it over at MSDN...tried googling....but have failed. Any inputs would be more than valuabl...more >>

Data Load
Posted by MS User at 4/13/2004 11:37:23 AM
SQL 2K We have a data-warehouse server which loads data from different databases which resides in a different server, perform business logic and load into a FACT table. I created 4 SQL jobs which does the above same thing from different databases and writing to same table. This job is schedu...more >>

Regular expressions
Posted by tguillor NO[at]SPAM ems.jsc.nasa.gov at 4/13/2004 10:44:29 AM
SS 2000 Is there a way to search a column, using a regular expression in T-SQL? Thanks...more >>

Update afield with string formula in another field
Posted by Ramana at 4/13/2004 10:43:23 AM
Hi I have table A with formulaid and formula for a caluculation (eg. Amount * Rate). Amount and rate are from table b. Table b has formula Id. In selects I can do Select a.Formula, b.Amount, b.Rate From a, b Where a.formulaId = b.formulaId. Is there a way to update let's say b.Calculate...more >>

How to manage security for emailing queries to server
Posted by varn at 4/13/2004 10:42:05 AM
I was so proud of myself a few moments ago. I had finally learned how to email a qeury to my sql server and have it email the results back to me. I did this using various extended sprocs like xp_readmail, etc.... I say "was" proud because I have now discovered that ANYONE can send the s...more >>

incorrect syntax error
Posted by DC Gringo at 4/13/2004 10:38:31 AM
I have a query giving me a message I can't seem to figure out... "Server: Msg 170, Level 15, State 1, Line 2 Line 2: Incorrect syntax near '='. Here's the query: SELECT t1.clnMinedAreaGUID, Max(IIf(v1.nomen = 'Unknown other UXO', 1, 0)) AS UXO, Max(IIf(v1.DeviceType = 'Anti-Personne...more >>

msdb..sysjobschedules and next_run_date
Posted by Amos Soma at 4/13/2004 10:14:21 AM
It seems that the 'next_run_date' stored in the msdb..sysjobschedules doesn't always (or hardly ever) match the next run time for a job that is displayed in Enterprise Manager. Can someone explain how/when this field gets updated (or better yet, the purpose of this field if it really isn't the n...more >>

Triggers
Posted by Fabio GRANDE at 4/13/2004 9:54:41 AM
Hi all ! Is there a way to know, when an insert,update,delete trigger fire, what am I doing ? I mean : am I inserting ? Or am I updating ? Or, maybe, am I deleting ? Thanx in advance Fabio G ...more >>

How do I use T-SQL to return a column default value/function?
Posted by Omri Bahat at 4/13/2004 9:39:14 AM
MSSQL2K... I am trying to use T-SQL to return a column default value (see example 1), or default function (see example 2). Examples: 1. Simple default constraint - assume an INT column 'Col1' on table 'MyTbl' with a default of 0. I'd like to return 0 given the table and column names. 2. M...more >>

Testing stored procedures
Posted by Gordon at 4/13/2004 9:28:16 AM
Is there a way to run a stored procedure from the Enterprise Manager? I'm trying to find a way to quickly test the sp's that I create. Thanks, Gordon...more >>

SQL Stored Procedure - Linked List
Posted by Mythran at 4/13/2004 9:23:50 AM
I'm trying to take a set of records which all have a field called PreviousId as well as ParentId. PreviousId is the previous id of the row before the current row. ParentId is the master id for the row. Basically, I want to select all rows given a ParentId and return them in order so the row...more >>

nvarchar vs varchar
Posted by Murphy at 4/13/2004 9:23:48 AM
Until now I have always used varchar however I have been examining some MS example db applications and have noticed they use nvarchar for things like customer name etc What is the difference and is nvarchar better than varchar for columns like customer name etc ? Thanks Murphy ...more >>

Sum and GroupBy problem,
Posted by Hoa at 4/13/2004 9:05:38 AM
Hi *.* I've a table used for a 6 levels accounting system contains a Date Col, Some other Cols about the account and 2 fields : Debit and Credit which used to save the price. I want to get sum of these two fields this way: User inputs a Date Range and I want to return flow of the account...more >>

Stored Procedure
Posted by MR.T at 4/13/2004 8:57:03 AM
Hello. I have a small problem. I have a query that working fine in the query analyzer but if the query is in a stored procedure I get error when I call the procedure. The procedure gets 2 parameters. The working query is: select top 10 ProcessName, id, startdate from ProcessData wh...more >>

Deadlock message
Posted by Gayathri.Jayaraman at 4/13/2004 8:20:13 AM
We are seeing deadlock message in the event viewer when running a transaction in sql server 7.0 database. Following is the message: "The description for Event ID ( 4 ) in Source ( TEST) cannot be found. The local computer may not have the necessary registry information or message DLL files...more >>

Comparing times
Posted by Mark at 4/13/2004 8:11:07 AM
This is probably a stupid question loads of people of asked before but... How can I easily compare the time parts of two datetime fields. E.g. If I had a table that had a timestamp field in it and I wanted to see all the records added or amended after 7pm (with the table having approximately one mo...more >>

How to insert a column between others
Posted by jb at 4/13/2004 8:11:02 AM
My code in question is to do with upgrading to later versions of the database. Often I want to insert a new column, and in development I have chosen to actually insert these columns between others, i.e. not just appended at the end. I know that ALTER TABLE ADD <column> is simple but will only appe...more >>

I Can't start SQL Service
Posted by Pippo at 4/13/2004 8:06:01 AM
Hi, when i try to start SQL Server Service I Have a Error. I Must Reinstall SQL Server 7 or i can repair without reinstall?? I have this Error: 2004-04-13 15:50:52.26 kernel Microsoft SQL Server 7.00 - 7.00.699 (Intel X86) May 21 1999 14:08:18 Copyright (c) 1988-1998 Microsoft ...more >>

Constraint vs Index
Posted by George at 4/13/2004 7:54:49 AM
When creating a Foreign Key constraint, does the server automagically create an index, as it does with a Primary Key constraint?...more >>

SQL Server Agent Question
Posted by Amos Soma at 4/13/2004 7:52:45 AM
Is there a TSQL statement I can execute to determine if the SQL Server Agent is running? Thanks, Amos ...more >>

selecting a field twice with one command
Posted by transql at 4/13/2004 6:41:06 AM
I have three tables: stats, profile, tea In table "stats", I have statid, profileid, teamid, oppid, stats1, stat2 In table "profile", I have profileid, name In table "team", I have teamid, teamname I need to select individual stats records that can call stats. profile.nam teamname(teamid ...more >>

Table ID with 4 or more Digits
Posted by Ototofioto at 4/13/2004 5:26:03 AM
Hallo All, I believe this must be pretty simple that the online-database has no similar record. To me, it is a mystery and I need your help. I have a table that I want the IDcolumn to have at least 4 digit num as ID without using trigger, for instance “00001...00000n” auto increase. The...more >>

List tables and columns
Posted by Henry at 4/13/2004 4:19:47 AM
Hi, How can I use T-SQL to list the tables, column names, column data type, column length of a database. Thanks....more >>

match those strings
Posted by Mikey at 4/13/2004 3:39:47 AM
Hi I want to match to colums from diff tables up on mfrpart and serialno both have matching 6 digit figures although mfrpartno has 10 in some instances but I only need to match the first 6 digits and disregard the remaining 4 digits on mfrpart does anyone know how to do this for a query ...more >>

ADO bulk insert and C++
Posted by Arne Adams at 4/13/2004 12:46:03 AM
Hi I am trying to use an ADO _ConnectionPtr to execute a (TSQL) bulk insert (in a multithreaded application). Sometimes this works and sometimes it yields the error : -2147467259 (with the same statement and the same database) When I execute the statement through the query analyzer it allways work...more >>


DevelopmentNow Blog