all groups > sql server programming > may 2004
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
running a SP on a table (of abitrary name)
Posted by toylet at 5/31/2004 11:52:19 PM
Could I apply a stored procedure on a table of specific strucutre?
--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.26
^ ^ 11:50pm up 1 day 5:12 load average: 1.42 1.36 1.37... more >>
how to include database with installation files of msde
Posted by Daniel at 5/31/2004 11:01:41 PM
I have created an application using VB6. The application uses MSDE to
access data. How do I include the required database with the installation
package.
Daniel
... more >>
Nvarchar
Posted by Joe at 5/31/2004 10:50:31 PM
Dear all,
How can I update a nvarchar field with a varchar field of
the same table?
Thanks.... more >>
smalldatetime
Posted by Frank Dulk at 5/31/2004 10:38:44 PM
the problem is that possess a field with format smalldatetime that has a
date of creation of a ticket.
I have to present how long it is open
each ticket, or be necessary to do the difference between this field and the
current moment,
and to present the result in the format hh:mm:ss.
Example:... more >>
SQL 2000 upgrade changes
Posted by Kim Strong at 5/31/2004 10:36:02 PM
Hi Al
I am in the process of upgrading SQL server 7 triggers and stored procedures to SQL 2000 and am looking if there is a diffinitive white paper on all the changes that should be made to your code.
Eg the change from suser_name -> suser_snam
... more >>
Dynamic table name in query
Posted by Shaul Feldman at 5/31/2004 10:33:46 PM
Hello,
I'm working with table when they are represented by ID (from sysobjects
table). What I need is to recieve all data from a table that it's ID I know,
let's say something like :
select * from 1234567 (1234567 as an example).
I have to provide the name, so I wrote a a code that retrieves th... more >>
How to tell if a stored proc included a Select statement
Posted by Ian Tompsett at 5/31/2004 10:06:01 PM
H
I'm calling some stored procs through dynamic sql (using sp_executesql). Having called my stored proc, I'd like to know if the stored proc included a select statement that would end up in the results sent out to ADO.NET. That is, did the stored proc return a result set or not
So if I call 3 su... more >>
trigger
Posted by toylet at 5/31/2004 9:50:11 PM
Is it safe to code uniqueness check in an INSERT trigger?
When a connection causes an INSERT trigger to fire, will other
connections' INSERT operations be suspended until the current INSERT is
finished?
I have a uniqueness requirement that's quite hard to be coded as a
constraint.
-- ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Function to format numeric data types?
Posted by Ben at 5/31/2004 9:26:02 PM
Is there a T-SQL function to format a value of float type, say 12456.00 to something like 12,456.00
Thanks
Ben... more >>
can u help me with this select ?
Posted by Krzysiek at 5/31/2004 7:36:07 PM
Hello All,
I have a simple table with 2 columns.
datetime int
27.05.04 1
29.05.04 2
31.05.04 5
and i need to get a view that looks like this below :
27.05.04 1 1
29.05.04 2 3
31.05.04 5 8
The third column shows a sum of numbers that were display before ... more >>
Telephone Numbers
Posted by Paul King at 5/31/2004 6:45:23 PM
Hi there,
Sorry to be a pain in zee butt but I need help again.....
I have setup a SQL table which contains various Columns. The issue I have
is with the TelNo column to store, yes you've guessed it! Telephone Numbers!
I have set the Data Type to be Numeric 9, but when I add a record this c... more >>
Advantages / disadvantages between stored procedures and functions
Posted by Rodger Dusatko at 5/31/2004 6:25:10 PM
Are there some situations where using functions would be advantageous to
stored procedures? When would a function be used and when should a stored
procedure be used instead? Does the functionality of a function exceed in
some cases the functionality of a stored procedure?
Rodger Dusatko
... more >>
Stepping through stored procedures not working
Posted by Rodger Dusatko at 5/31/2004 6:22:59 PM
For some reason I am not succeeding in stepping through my stored procedures
(I'm using VB.NET with Windows Server 2003).
Instead of allowing me to go step by step, the procedure is executed.
yours truly
Rodger Dusatko
... more >>
Is there some documentation which can be recommended for learning the riches in stored procedures?
Posted by Rodger Dusatko at 5/31/2004 6:18:09 PM
I have found some examples, but a lack of any methodolical approach for
learning stored procedures. Can anyone recommend to me a good reference /
learning book?
yours truly
Rodger Dusatko
... more >>
How do I declare a numeric parameter?
Posted by Diarmuid at 5/31/2004 5:11:38 PM
Hi
I'm trying to run a stored procedure from VB6, using ADO. So I've
declared several parameters, for example
Set objParm = New ADODB.Parameter
objParm.Name = "pLIN_T_BAT"
objParm.Type = adInteger
objParm.Direction = adParamInput
objParm.Value = 0
objCmd.Paramet... more >>
Move DTS Package to Another System
Posted by Prabhat at 5/31/2004 5:11:25 PM
Hi All,
How do I move all / some of the DTS Packages in my system (SQL Server) to
another system (that system may be out side of my local network)?
I am able to save the DTS Package in file (*.dts) using save as option but
don't know how top open/load that in target system. How do I do that?... more >>
Difference between * = and LEFT Outer Join
Posted by Hari at 5/31/2004 4:37:07 PM
Hi Guys,
Is there any difference in using * = and LEFT OUTER Join apart from ANSII
complient.
Reson is today I have received 2 different results set in the usage of both.
Some time back I have read in one article stating that there is some
difference in both usage, but I couldnt recollect.
C... more >>
DTS Global Variable
Posted by Prabhat at 5/31/2004 3:44:33 PM
Hi All,
I have one DTS Package which Import Data from Foxpro database to SQL Server
Tabel. I have some Global Variable in my package. And I execute the Package
from with in a Stored proceure - as I need to pass value to Global varibale.
I am able to do that.
I wanted to know is there a way ... more >>
columns
Posted by frazer at 5/31/2004 3:15:38 PM
hi
why cant i use sp_columns in a subquery?
select * from
(
sp_columns @table_name = 'group'
)
as a
i am aware that i can query syscolumns as follows
select * from syscolumns
where id =
(
select id From sysobjects
where name ='group'
)
but i want to be able to use sp_co... more >>
DATEDIFF / DATEPART inconsistent for DW ?
Posted by Damien Laffan at 5/31/2004 2:42:03 PM
------------------------------------------
Microsoft SQL Server 7.00 - 7.00.1063 (Intel X86)=20
Apr 9 2002 14:18:16=20
Copyright (c) 1988-2002 Microsoft Corporation
Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 3)
------------------------------------------
(Except for the... more >>
Place "Exec sp.*****" in Cursor ??
Posted by Maik Siegel at 5/31/2004 2:21:05 PM
I tried to put an "Exec" command into a cursor for executing a stored procedure, but i receive an error every time
Can´t i put a stored procedure into a cursor ??
The sql-statment is
Declare B Cursor fo
EXECUTE [pia].[dbo].[sp_GehaltsummeZumProjektSAB]
open
fetch next from b into @
c... more >>
Get ID
Posted by Just D at 5/31/2004 2:14:54 PM
Hi All,
If I insert a new record in the database table, the RecordID (PK, INT, NOT
NULL, Identity, etc.) should be assigned automatically. I need to get this
ID that the database assigned to this record. What's the easiest way for
that? SP?
I need this ID to enter the dependent records i... more >>
Error Executing DTS
Posted by Prabhat at 5/31/2004 2:01:21 PM
Hi All,
I have create one DTS (Local) which will Import Data from a .dbf file to SQL
Server table.
I have one Global Variable "gSourceFile" which takes the .dbf file path +
file name and import that to the specified table. When I Run the DTS I get
the below error:
DTSRun: Loading...
DT... more >>
WEird Column as Int property returns Decimal!!
Posted by Patrick Delifer at 5/31/2004 1:29:58 PM
I am trying to get back the primary key value of a record I'm creating
using @@IDENTIY. It works fine, but I noticed that in my query analyzer,
the value is returned as a decimal where instead it should be an int
(INT is it's property in the DB table)..What is that?? So i ran other
stored proced... more >>
qualifying on dates w/o including times
Posted by Leslie at 5/31/2004 1:04:43 PM
I am writing a query that will be used within a DTS
routine. I am writing data to a temp table then would
like to import only data with yesterdays date. When I
qualify on getdate() - 1, it only picks the exact
date/time 24 hours ago. How can I qualify between
yesterday's date at 00:00 a... more >>
Dynamic sql statement with like
Posted by Frank at 5/31/2004 12:46:03 PM
Im making a dynamic sql statement with like, when I have this
set @check = 'Bad
declare @select varchar(50
set @select = 'select * from art
declare @where varchar(50
set @where = 'where
declare @inv varchar(50
set @inv = 'and inventoryid =13
declare @like varchar(50
set @like = '(s... more >>
Access to T-SQL query
Posted by Mark at 5/31/2004 12:06:03 PM
I've been given a report in Access to convert for use in Reporting Services (RS). When the user runs the report in Access, their presented with a form, in which they enter a criteria. This criteria is referenced in a few queries in Access, like so [Forms]![frmMain_Menu]![txtCriteria]. Some of these ... more >>
Problem with select statement
Posted by Jim at 5/31/2004 11:56:06 AM
Im trying to join two tables...artist and artistnationality, the select statement is trying to select artists that have both a nationalityid of 1 and of 2..
select nationalityid,artist.firstname, artist.lastname from artistnationality, artist wher
artist.artistid = artistnationality.artistid and(... more >>
What is the relationship between precision and length
Posted by Ray at 5/31/2004 10:48:18 AM
Hi,
I am a new user of SQL. I would like to ask what is the relationship
between precision and length for the data type "numeric". Since I have to
change the precision in order to change the value of length, so I would like
to know the relation between them. I'm not so clear about the concept... more >>
Need code... help.
Posted by RJ at 5/31/2004 10:01:02 AM
Sorry, I am not a programmer but would likely be able to figure it out but I have very little time (as do most of you likely). But..
What I need is a do while or looping script (or some other type of function) in a stored procedure to be able to populate an empty table with all date values (i.e. ... more >>
Error Trapping and temp tables
Posted by Mark L. Breen at 5/31/2004 8:59:24 AM
Hello All,
I am developing a db and intend to use a temp table. Before use I create it
and after use I drop it.
However, because I fear it may somehow remain in the system, I would prefer
to do a
If exists (table name) drop table name
But it is not that easy with temp tables, as you kn... more >>
Read text file into one field, one record
Posted by Dave at 5/31/2004 8:51:06 AM
Hi - here's a nice challenge
I have an html file in c:\temp (created by sp_makewebtask) I would like to import into a table, tbemailtemp, which has one field, HTMLDoc.
The whole file must go in the first record, using a command in a stored procedure.
The file length of the HTML doc is not fixed.
... more >>
Stored procedures & triggers
Posted by Peter Newman at 5/31/2004 8:31:02 AM
Im writing a vb6 application that uses a recordset created from two tables joined by a single field. I have a problem when the operator wants to insert a record, and the only way i think i can manage this is by using a trigger on the main table to insert a record into the secondary table. In Query... more >>
Format xp_sendmail output
Posted by Marc-André at 5/31/2004 6:26:02 AM
Can someone tell me how to format xp_sendmail output. The problem is that my colums are to large and I want to have output without line breaks.
I have tried @width parameter but I doesnt help me ....
Thanks... more >>
Last 12 months query..
Posted by Rocky Moore at 5/31/2004 6:16:13 AM
This may be a simple query request. I have data with a datetime field
spanning years. My goal is to have results return 12 records that represent
the total number of records for each month for the last 12 months including
the current.
Is there any way to do this without sub selects?
--
... more >>
How to create computed column in a Select statement
Posted by simonlenn NO[at]SPAM yahoo.com at 5/31/2004 4:59:08 AM
Hello All
I am trying to use in the following Pivot table from MS KB article a
computed column:
Year Quarter Amount
-------------------------------
1995 1 125,000.90
1995 2 136,000.75
1995 3 212,000.34
1995 4 ... more >>
How can I know what sql servers are running?
Posted by KPH at 5/31/2004 3:31:02 AM
Hi
I would like to check the servers that are running on LAN. How should I do
KPH... more >>
UDF Query
Posted by Babz at 5/31/2004 3:31:01 AM
Hi
How to pass a dynamic value in the udf function. is there any way
Select * from dbo.GetRec(EmpId) EF inner join Emp E on EF.EmpNo = E.EmpI
The udf will return me the table that has empno, orderi
Need Hel
Babz... more >>
Curious !!
Posted by Anand at 5/31/2004 2:41:03 AM
Hi Gurus
Is it ok to use a CASE in my select statement? Are there any advantages/dis-adv in using CASE
I solved a problem of mine by using a CASE. However, i want to make absolutely sure about the cost of using this CASE as the amount of data in which this query will be running will be around 400m... more >>
Query Problem
Posted by Babz at 5/31/2004 2:06:02 AM
H
I am facing a peculiar problem, my data are stored in the db as follow
OrderId OrderItem
------- ----------
1 Itm1,Itm2,Itm
2 Itm4,Itm6,Itm7, Itm
But I need output lik
OrderId OrderIte
------- -------------
1 Itm
1 Itm
1 Itm
2 Itm
2 Itm
2 Itm
2 Itm
Actually I have... more >>
problem in case in where clause
Posted by Anand at 5/31/2004 12:36:02 AM
Hi Gurus
I have a description table wherein the description is stores for different languages
Now, for eg, if this table contains 2 rows,
------------------------------------------------------
itemid description lanuagei
------------------------------------------------------
1 ... more >>
can store procedure return result ??
Posted by Agnes at 5/30/2004 11:59:03 PM
I know how to pass the parameter to store procedure, however, can it return
some item results ???
I want to get back the name,address1---4, Thanks a lot
my code is
CREATE PROCEDURE dbo.companyinfo_shipper_search
@searchcode varchar(10)
as
select code,name,country,address1,address2,address... more >>
Stored Procedure for Concurrency check
Posted by Makarand at 5/30/2004 11:46:03 PM
Hi All
Does anybody have written 'Generic' Stored Procedure for checking Data Concurrency using timestamp in SQL Server 2000.
I am trying to write one which is not working as per my expectation.
Please have a look at it
CREATE PROCEDURE Proc_Check_Concurrency
(
@old_modified_date AS dat... more >>
design suggestion required
Posted by kamal at 5/30/2004 11:11:03 PM
we have an application built on ASP(Application Service Provider) model
In which we are planning to have a separate database for each client on a single server
What propbale issues can we face apart from the hardware requirements
rgd
kamal... more >>
Stored Procedures Report Executed
Posted by Dan at 5/30/2004 9:04:30 PM
I have an application that I would like to create a table
and insert into the table when each stored procedure
(1800 Stored Procedures) was executed and by what
userid?
Example:
Create table Report_StoredProcedure (
start_execution_time datetime;
finish_execution_time datetime;
St... more >>
Create Name for a Calculation Used Often
Posted by mike at 5/30/2004 7:02:29 PM
Newbie question here...I've migrated an Access database in
which I had a formula that I used often to calculate the
last business day. It looks like this:
Yesterday: IIf(Weekday(Date())=1,DateAdd("d",-2,Date()),IIf
(Weekday(Date())=2,DateAdd("d",-3,Date()),IIf(Weekday(Date
())=7,DateAdd("d"... more >>
Smalldatetime Issue
Posted by Paul King at 5/30/2004 4:05:12 PM
Hi, Im new to SQL and programming.
I have constructed a small table with several columns and their associated
data types. I have created one called Date and made this smalldatetime from
the DataType.
When I display the information via a DataGrid page in ASP.NET this shows the
date + time (... more >>
Why don't put all SQL statement into Store Procedure?
Posted by AA at 5/30/2004 3:15:22 PM
Dear All,
As I know that the performance of Store Procedure is better than execute
SQL Statement directly.
Why don't put all SQL statement into Store Procedures?
Can store procedure replace all SQL statements?
Is there any bad side effect?
Thanks
Anthony
... more >>
Unusual SELECT Statement
Posted by Alex Clark at 5/30/2004 1:54:05 PM
Hi All,
I'm having a few difficulties defining a rather complex Select statement,
and I'm hoping someone here can help.
I have a table of Customers, the primary key of which is CustID +
CustVersion. CustID stays with the Customer record for life, however if a
significant change is made to ... more >>
CHARINDEX and PATINDEX not deterministic?
Posted by TomTom at 5/30/2004 1:51:52 PM
BOL says:
Deterministic and Nondeterministic Functions
All of the aggregate and string built-in functions are deterministic except
the string functions CHARINDEX and PATINDEX.
--------
Why are CHARINDEX and PATINDEX not deterministic?
Just curious.
TomTom
... more >>
|