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 2005 > threads for tuesday april 26

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

Access denied when running sp_OACreate from sp
Posted by Magnus Nordin at 4/26/2005 11:38:21 PM
Hi, I have a BIG problem, I'm trying to run sp_OACreate from a sp and keep getting "Access Denied", this works just fine on my dev.machine but on the production server it doesn't work at all. I've read all the papers I can get my hands on and have gone through all the permissions but still mi...more >>

Deadlock error(-2147467259) + SQL Server
Posted by anylcumar NO[at]SPAM gmail.com at 4/26/2005 9:34:07 PM
Hello, I have a window-less VB application running as a SQL server job. The application is very simple and it just picks up the blob file from filesystem and inserts into the database. I am using SQL Server 2000 running on Windows server 2003 standard edition. Most of the time my ...more >>

an UPDATE inside a SELECT
Posted by Hussain Al-Dhaheri at 4/26/2005 8:58:27 PM
I was wondering if it is possible to have an UPDATE satement inside a SELECT statment. What I want to do is select certian rows from a table then based on the result I want to update another table. Metaphorically something like the following SELECT A.QTY,(UPDATE TABLE B SET QTY=A.QTY WHERE B.[...more >>

Alias not recognized
Posted by PK9 at 4/26/2005 8:43:06 PM
I'm attempting to refer to an alias in my SELECT clause (within a stored procedure). Basically I'm building a string which I will eventually execute by calling the "exec" statement on my string. Within my string, I have 3 columns for my SELECT clause. Here is an extremely watered down e...more >>

Printing a SRS report from the command line
Posted by bansalh at 4/26/2005 5:17:04 PM
Does any one know how to print a SRS report in PDF format from th command line? I know that I have to use the rs.exe utility and that' about it. Any help would be much appericated -- bansal ----------------------------------------------------------------------- bansalh's Profile: http://www...more >>

quoted_identifier
Posted by Rick Charnes at 4/26/2005 4:41:02 PM
How do I see the current value of QUOTED_IDENTIFIER in a SQL2000 database? Thank you....more >>

Searching for column and table
Posted by Joel at 4/26/2005 4:30:36 PM
Given a column name what's the best/fastest way to find all instances of the column name and the table that each belongs to? TIA </joel> ...more >>

Function sequence error with bcp call from a stored procedure
Posted by jacob4408 at 4/26/2005 3:36:03 PM
I have a stored procedure that contains a series of bcp calls to export data. The bcp calls are executed by xp_cmdshell and are all the same (other than the table name of course). I have SET NOCOUNT ON as the first line in the stored procedure and it is not returning any data. The bcp cal...more >>



rss feeds on SQL Server
Posted by Mike P at 4/26/2005 3:26:26 PM
Does anybody know of any good rss feeds on SQL Server? Any advice would be really appreciated. Cheers, Mike *** Sent via Developersdex http://www.developersdex.com ***...more >>

Concatenated input parameter for stored proc
Posted by Andy at 4/26/2005 1:32:12 PM
I have never had to do this before, but is it possible to pass in a parameter to a stored procedure that is concatenate? for example exec VaultResources.dbo.usp_UTIL_GrantPermission 'vw_ACAPSSOL_' + @YYYYMM Or do I need to create a separate variable and do the concatenate before calling t...more >>

Documenting triggers
Posted by Mark at 4/26/2005 1:01:32 PM
I believe in avoiding triggers whenever possible. However, in the circumstance that a trigger is the "right" solution, I'd be curious how people document/diagram triggers so that a successor could actually find them aside from just having a document that says "by the way, there are some tri...more >>

Trigger Programming
Posted by Mark King at 4/26/2005 12:56:02 PM
I have a 2 systems that we store employee data in, one for the time clock and another for our payroll systems. We would like to update information on only our payroll system and have that update the time clock database. They are both SQL databases and on the same server (but different databa...more >>

Get List of Current Named Transactions
Posted by BDB at 4/26/2005 12:35:33 PM
Hi, Is there a way to get a list of all the current named transactions? Bryan ...more >>

ORDER BY NEWID() returning duplicates records
Posted by TonyG at 4/26/2005 11:39:06 AM
This returns 2 random records for me. However, on occasion, the 2 records returned are identical. Does anybody have any thought for preventing this from happening? SELECT TOP 2 P.*, C.CatID FROM JEP_tblProducts P, JEP_LtblProductCategories C WHERE P.Image1<>'' AND C.ProductID = P.ProductID ...more >>

VB function vs. SQL stored procedure
Posted by ChristyWarner at 4/26/2005 11:32:09 AM
Hi, I'm trying to decide whether to keep some functions in VB 6.0 or develop them as SQL stored procedures; such as the "isnull" function in VB. If I developed an equivalent function as an SQL stored procedure, do you think system performance would be enhanced? Thanks! -- Christy W...more >>

adding identifier number to records
Posted by Chris at 4/26/2005 11:00:05 AM
I have a table already created and need to add an autonumber/ unique identifier field. If the table already contains records can I just add the new autonumber field and run a query to populate this field for all records with unique values? how do I do this? are their other ways of doing t...more >>

Finding column use with syscomments
Posted by DWalker at 4/26/2005 10:59:30 AM
In SQL 2000, I know that "Display Dependencies" (and probably the Sysdepends table) are not accurate. Does the syscomments field for a view always contain the correct and current view definition? I need to find all uses of a given field across all views (there are about 150 views). Is...more >>

it doesn't correlate
Posted by M D at 4/26/2005 10:59:27 AM
SELECT [Pcode], avg(convert(float,[Seq])) FROM [DB].[dbo].[PartyTime] WHERE [Seq] IN (select top 8 [PartyTime].[Seq] from [PartyTime] JOIN [PartyTime] [PT] ON [PartyTime].[Pcode] = [PT].[Pcode] AND [PartyTime].[Seq] = [PT].[Seq] ...more >>

Subquery with compound key
Posted by Terri at 4/26/2005 9:48:57 AM
Sorry for the lack of DDL. I'm hoping someone can help me without it but will post DDL if requested. Given three tables with identical structure (not my design): Table1, Table2, and Table3 . Each table has a compound primary key with the columns A, B, C I'm trying to build a SELECT that will...more >>

Calculate percent based on SUM
Posted by Terri at 4/26/2005 9:08:18 AM
I'd like to calculate the percent of the total for column DataValue. So if the sum of column DataValue is 200 and the values for record A is 25 I'd like to return 12.5% Based on my sample data I'd like to return: A,12.5 B,25 C,12.5 D,50 CREATE TABLE TEST (ID varchar(1),DataValue int) ...more >>

Novice Struggling with Query
Posted by enrique at 4/26/2005 8:48:02 AM
Hi, I need to display only records from one table(t1) that don't have records in another table(t2). In other words these two tables... table1 table2 itemID | sectionID subItemID | itemID | sectionID | showID ------------------------ ...more >>

Comparison to NULL and '' fields
Posted by Just D. at 4/26/2005 8:42:45 AM
Guys, can anybody remind the settings responsible for the results of the search by the NULL fields? I saw this database setting several months ago but forgot this switch. The problem is the following. We're trying to run a search in a few tables using some SQL query with a multilevel combinati...more >>

select most recent of a set of records.
Posted by Bryan Ax at 4/26/2005 8:30:39 AM
Let's say I have the following table LoanId int FileName varchar(50) DateCreated datetime that's a history table of all of the files associated with a loan. It may contain multiple records for each 'filename', i.e. 1, 'FileName1', 4/24/2005 12:00:00 AM 1, 'FileName1', 4/25/2005 12:00:00...more >>

Passing table to MSSQL stored procedure
Posted by John Spiegel at 4/26/2005 8:15:40 AM
Hi all, Any suggestions on the best way to pass a set of values to a stored procedure that will use them in a query? Specifically, I want to call a stored procedure from .NET that takes a set of phone numbers and returns a resultset of records containing these numbers from a table. Is it ...more >>

Interesting Query Results
Posted by dott NO[at]SPAM accessGeneral.com at 4/26/2005 8:03:55 AM
I was doing a code review and found code that was similar to the code below. Bad style/practice aside, I was surprised that it ran without error and did not give "expected" results. Expected meaning five one-row ouptuts. This is using SQL Server 2000, can anyone tell me if 2005 will act the sam...more >>

stored procedure inserts: can i get the value of the identity column?
Posted by jason at 4/26/2005 8:01:11 AM
if i have the following table: create table owner.mytable ( identitykey int IDENTITY (1, 1) NOT NULL, description varchar (50) NULL ) and the following stored procedure: create procedure owner.myprocedure ( @description varchar(50), @identitykey int output) as insert into o...more >>

Driver Not Capable - Error
Posted by phil at 4/26/2005 7:41:01 AM
I'm getting this error and I don't know where to begin. Our environment is SQL Server 2000 sp3a on Win Server 2003. I get the error when running an insert statement in a sql job that executes as the admin. The insert is a simple one from one table to another. Ultimately, I need to inse...more >>

Pagination with SP
Posted by Don Miller at 4/26/2005 6:44:26 AM
I'd like to write an SP with parameters that returns specified groups rows in ordered groups of arbitrary size. Kind of a "sliding" TOP. Like, show me the first 40 items in a list, show me the 4th group of 40 items in a list, show me the Nth group of X items, etc. I see this kind of thing all the...more >>

Call external program from a stored proc / trigger
Posted by aiKeith at 4/26/2005 5:46:02 AM
What is the stored proc that can call an external exe, etc. from a stored procedure, function, trigger, etc.? I can not for the life of me remember what it is. I need to an action upon row inserts and wanted to have a trigger run an external program. thanks, ...more >>

Function Call - Syntax error
Posted by kd at 4/26/2005 5:32:04 AM
Hi All, I have defined a function and want to call the same in a stored procedure. The function call is giving me syntax error! Here is the function call. function_name(@param) What is the correct syntax to call the function? kd...more >>

Help with SQL query from ASP
Posted by straighteight NO[at]SPAM gmail.com at 4/26/2005 4:11:08 AM
Hi, Not sure if I have posted this is the right place, if anyone could point me in the direction if I'm wrong I'd be grateful. Anyway, heres my query, I have a SQL query which is searching records where a date has past, and it works fine in SQL query analyser. Heres an example of the query....more >>

Help Optimize my Query
Posted by mPiccoli at 4/26/2005 3:27:03 AM
that takes 20 seconds may however maximally 5 last how am I to provide the indices? fill factor? SELECT TOP 250 dbo.IHLEAktionenPlan.AktionenPlanID, dbo.IHLEAktionenPlan.AdressID, dbo.IHLEMassnahmeStamm.Bezeichnung AS Massnahme, dbo.IHLEAktionenStamm.Name AS Akt...more >>

Getting one record at a time
Posted by Jamz at 4/26/2005 2:47:02 AM
I have a stored procedure that I call from a VB6 program: DECLARE @myid UNIQUEIDENTIFIER BEGIN TRAN SET @myid = NEWID() UPDATE data WITH (ROWLOCK) SET UID=@myID, Done=1, DateTimeDone=GetDate() WHERE ID= (SELECT TOP 1 ID FROM data WITH ( XLOCK, READPAST) WHERE done=0 and ready=1) C...more >>

What in the Tarnation is this N'Varchar crudatola?
Posted by Candor Feg at 4/26/2005 1:53:46 AM
Why on earth am I to be encumber'd with putting N' in front of all sorts of stuff? You'd think that apostrophes and Ns everywhere would eventually piss everyone off. Yet, I look around me and I see it isn't so. Oh, no. What's wrong with that? I need to know. Here I go again... Who wan...more >>

Usage of the 'FOR UPDATE' clause in the cursor definition
Posted by kd at 4/26/2005 12:11:02 AM
Hi All, When is the 'for update' clause used in the cursor defintion statement? Is it required to provide the 'for update' clause in the cursor definition statement, if the fields in the cursor defiintion are not updated, rather another field that is not included in the cursor selection st...more >>

How to implement a custom Order Column?
Posted by Patrick Wolf at 4/26/2005 12:00:00 AM
Hi, the table look like this: id, area, areaorder, areatext 1, group1, 1, Group1Text A 2, group1, 2, Group1Text B 3, group2, 1, Group2Text A 4, group2, 2, Group2Text B We need to be able to keep the order in each group, but also the ability to insert and update within a group eg. "INSE...more >>

how to return only last select from stored procedure
Posted by TomislaW at 4/26/2005 12:00:00 AM
I have 3 selects in my stored procedure I am using first and second select just for calculating number of rows (@@ROWCOUNT), and last one is the final select that I need. But I get all three selects Tomislaw ...more >>

select only the newest rows
Posted by Luis at 4/26/2005 12:00:00 AM
Hi all, I have the following problem. I have two tables. The first table has some columns (idPerson, idCharge, reference, etc), but i only need the idPerson column. The second table has some columns (idCharge, Amount, date, bank, etc.). Example table1 idPerson, idCharge, reference 001, ...more >>

return first row of each group
Posted by Stephen Ahn at 4/26/2005 12:00:00 AM
Example data : == create table t1 (a int, b varchar(20)) insert t1 values (1, 'one') insert t1 values (1, 'one-one') insert t1 values (1, 'one-one-one') insert t1 values (2, 'two') insert t1 values (3, 'three') insert t1 values (3, 'three-three') == I want to return a result set whi...more >>

Use CURSOR or not, this is a question
Posted by E B via SQLMonster.com at 4/26/2005 12:00:00 AM
Hi i have some problem that as i understand can be solved by using of CURSOR Suppose i have some stored proc it does something ... ... ... ..... .. and fills the following table DECLARE @t TABLE( [SID] [int] NOT NULL , [SName] [nvarchar] (30) NOT NULL , [STID] [int] NOT NULL ) t...more >>

bulk insert on remote computer
Posted by Vince
Hi there! I am using bulk insert to enter data in tables. I try to bulk insert data on a remote server but the bulk insert statement must access files located on localhost computer (from where I query a bulk insert with query analyser)..and I get a 'access denied' from sqlserver the only ...more >>

how to search how many instance SQL server in network?
Posted by nick at 4/26/2005 12:00:00 AM
Hi all: Not sure it's a right forum to ask this question . what i want to do is that programming a small winform to get all SQL server name in local Network? Thanks Nick ...more >>

replicate db on an other server
Posted by Geo at 4/26/2005 12:00:00 AM
Current situation. We have a website running on NT server populated from SQL 2000 every thing is cool. The powers that be want to run a new version of the web site on a bigger box (Windows 2003 server SQL 2000 bigger bandwidth etc) with the intention of killing the old box in the near fu...more >>

differentiating between MSDE and other SQL Server editions
Posted by Onkar Walavalkar at 4/26/2005 12:00:00 AM
I want to be able to detect whether a SQL server installation is a pure = SQL server installation or an MSDE installation. I want to be able to = differentiate between these 2. I have seen the following observations after running = select serverproperty('edition') command and running select @@v...more >>

Execution Time
Posted by Saradhi at 4/26/2005 12:00:00 AM
Is there any way to estimate the time required to execute a T-SQL statement? I need to set the command time out by calculating the time for T-SQL statement. Can any one give an example? -SARADHI ...more >>

I need help with Float datatype
Posted by ninel gorbunov via SQLMonster.com at 4/26/2005 12:00:00 AM
I have a breakAmt field in my table that is a float datatype. The values need to be in hours. So if employeeA took a break for 1 minute it should be 0.016. If EmployeeB had a 19 minute break it should be 0.316. If EmpC took a 3 minute break I get the value 5.0000000000000003E-2. How can I convert...more >>

p/c selfjoin question
Posted by Thomas Seidel at 4/26/2005 12:00:00 AM
Hi, I need some help on a specific self join question. I have a parent/child table: CREATE TABLE [TAB_PC_KST] ( [Element] [varchar] (255) NULL , [Parent] [varchar] (255) NULL , [EType] [char] (1) NULL , [Weight] [float] NULL , ) ON [PRIMARY] GO where EType is the element type a...more >>

Creating a trigger
Posted by Ivan Debono at 4/26/2005 12:00:00 AM
Hi all, I've never played with triggers before but I need to create one, so I guess I need some help!! I've got a table TABLE1 in DATABASE1 and it has 2 fields MYID and MYNAME. This is where the trigger needs to be created. MYID refers to a field in another table in another database. I n...more >>

loops oops
Posted by Mary Poppins via SQLMonster.com at 4/26/2005 12:00:00 AM
Hi, How can I walk through a result of a select query? I have two tables. TableA(id, name1, name2, notes), TableB(id, grade). I have to bulk insert some data, (given: name1, name2, notes and grande too). The "bulk insert" inserts datas in one step. So first I insert the values a temporary tabl...more >>

How To Export with full sql syntax?
Posted by Bpk. Adi Wira Kusuma at 4/26/2005 12:00:00 AM
I use SQL Server. Can I export data to Excell, Lotus, etc With syntax SQL? Can U give me examples! ...more >>

Self Referencing Table question
Posted by Steven Reid at 4/26/2005 12:00:00 AM
Hi All, I have the following self referencing table which lists portfolios and a master portfolio number for clients. The simplified table structure is as follows: CREATE TABLE dbo.portfolio ( PortfolioID int PRIMARY KEY, MasterPortfolioID int ...more >>

User defined functions?? In MSSQL 7
Posted by henry at 4/26/2005 12:00:00 AM
Hi isn't it possible to define this i an older MSSQL? It works fine in my MSSQL 2K CREATE FUNCTION fn_getisoweek (@DATE datetime) RETURNS int AS BEGIN DECLARE @ISOweek int SET @ISOweek= DATEPART(wk,@DATE)+1 -DATEPART(wk,CAST(DATEPART(yy,@DATE) as CHAR(4))+'0104') --Special c...more >>

Disabling/enabling of trigger & distributed transaction
Posted by Kriste L at 4/26/2005 12:00:00 AM
I've 2 windows 2000 server running each own instance of SQL2000. I've setup both linked servers @ both end. At server A, it'll call a sp in server B, whereby this sp will update server B tables based on server A's data. And the server A table A will trigger back to server B. However due to so...more >>

Probs with performance
Posted by Fabri at 4/26/2005 12:00:00 AM
Hi, w2k server sp4, sql 2k sp3b: I had problems with msdb because of disk out of space for about 2 days. Now, after delete some stuff and restart the server, performance drastically fall down. Tracing the server shows me that most of event higher in cpu, duration reads are related to...more >>

Search Database
Posted by Lara at 4/26/2005 12:00:00 AM
Hi, I am planning to build a search engine which works like GOOGLE. Can anybody send me a sample database .. regards Lara ...more >>

reading text column @ QA
Posted by Kriste L at 4/26/2005 12:00:00 AM
Hi Everyone, I've a table with text column [nText 16] to keep email in html code. The data in this text column is inserted via program and the whole html code can be retrieve via the program. However, when did a "select sql" @ the query analyzer, only the first few lines of the html code ar...more >>


DevelopmentNow Blog