all groups > sql server programming > november 2003 > threads for thursday november 20
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
Having trouble with SELECT UNION
Posted by Joseph Geretz at 11/20/2003 11:45:07 PM
I have created the following VIEWS in my database. (Sorry, they're quite
long, but I've reproduced them exactly below.) In a nutshell,
VMSGRECIPIENTSA and VMSGRECIPIENTSB return the same record structure.
VMSGRECIPIENTS simply pulls these two together via a UNION. (For brevity,
I'n going to call... more >>
Ole
Posted by Lang at 11/20/2003 10:30:55 PM
How can i store in a Sql table an attachment to a
document.
For example my application manage a word document and i
have to store it in a table as ole object
Thank's... more >>
enterprise manager connection options
Posted by John A Grandy at 11/20/2003 10:12:14 PM
when creating a stored procedure or a user defined function using enterprise
manager, how to determine the settings for the connection under which the
create sql is being executed ....
i'm talking about settings such as ANSI_NULLS
enterprise manager : <database name> : properties : options
... more >>
Updateable Query
Posted by paul NO[at]SPAM palmnospam.com at 11/20/2003 10:04:55 PM
I'm having problems converting the following query (called through ADO,
SQLOLEDB)
from Access to SQL 2000 and making it updateable:
SELECT tblBalances.*
FROM
(
SELECT tblTemp.ID FROM tblTemp
WHERE (((tblTemp.SessionID)=263532309) AND ((tblTemp.Func)=3))
) AS sqlTempID
INNER JO... more >>
[HELP] Exists some editor to develop TRANSACT SQL, like PLSQL Developer for ORACLE ??? (thanks)
Posted by gurbinag at 11/20/2003 8:56:29 PM
that´s all
thanks
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..... more >>
Identity Column Nightmare
Posted by Larry at 11/20/2003 8:00:22 PM
I have a table with an identity column which is also it's
primary key.
An application inserts a new record (whereby the identity
column gets incremented -- or so it's supposed to do).
The the application re-retrieves the row it just created
and a completely different, pre-existing record p... more >>
Help file for sql-server
Posted by Mr. x at 11/20/2003 7:08:41 PM
Hello,
I need an help file (*.chm is preffered, but any will be fine) of
Sql-Server, please.
Where can I find such one ?
Thanks :)
... more >>
Copy and retain default values
Posted by dontspammenow NO[at]SPAM yahoo.com at 11/20/2003 7:07:31 PM
I want to replicate one table as another table with a different name
in the same database. Same schema, same default values, and same key.
Using SQL Server 2000. What's the best way to do this? I tried DTS,
but I seem to lose the default values. If I attempt to do a transfer
objects option... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Need a query for data structure transformation
Posted by GB at 11/20/2003 6:02:12 PM
Hello:
I have a table T1 like this:
NameID | F1 | V1 | F2 | V2 |
------------------------------------------
1 A 49% B 51%
2 C 35% D 65%
3 E 20% B 80%
4 D 10% A 90%
I need a query to transform T1 ... more >>
How to prompt the user for info in stored proc
Posted by newman at 11/20/2003 5:48:00 PM
I have created a stored procedure and I need to prompt the
user for a date and I am have trouble getting the syntax
right. Can anyone help me with the sytax or point to where
I can find info
Regards
Newman
... more >>
Stored Proc calling an asp on another server.
Posted by John Smith at 11/20/2003 5:21:55 PM
Is it possible to have a stored proc make a call to an asp on a web server?
Thanks
... more >>
Pass variable from VBA to stored procedure
Posted by Ling at 11/20/2003 5:21:07 PM
Hi, I am very new to stored procedure. Currently, I have linked my tables in Access to SQL server. I use VBA to do the calculations for my forms in Access
How do I pass a variable from VBA to stored procedure
e.g.: a = "Select ID from Employees Where Name = 'Peter'
How do I pass thisd var a to ... more >>
Not recognizing IIF or IS
Posted by Graham R Seach at 11/20/2003 4:57:45 PM
Hi guys,
I'm using SQL Server 2000 Std Ed. I'm trying to build a simple SQL view
which I've simplified as follows:
SELECT PersonID,
IIF(CreatedBy IS NULL, 'yep', 'nope') As something
FROM tblperson
The problems are that SQL Server...
a) doesn't recognize IIF as a val... more >>
Delete questions
Posted by DCHorton at 11/20/2003 4:25:37 PM
I have 2 tables:
POOrderDetail:
pdtl_order char(15) NOT NULL,
pdtl_line int NOT NULL,
pdtl_orderqty int NOT NULL
POReceive:
prec_order char(15) NOT NULL,
prec_line int NOT NULL,
prec_quantity int NOT NULL,
prec_infull bit
POReceive ties to POOrderDetail by prec_order=pdtl_order A... more >>
SP transaction question
Posted by DCHorton at 11/20/2003 4:17:36 PM
I have an SP which does the following (POOrderDetail is tied to
POOrderHeader by pdtl_order=phdr_order):
CREATE PROCEDURE dbo.pPOPostRecv
(
@in_batch integer
)
AS
DECLARE @intErrCode integer
SELECT @intErrCode = @@error
BEGIN TRANSACTION
IF @intErrCode = 0
BEGIN
-- deletes records... more >>
exclusive Transactions
Posted by Andy NoSpam at 11/20/2003 4:02:11 PM
Hi,
I have the following problem which is annoying me for some days...
I have build a web application with C# and ASP.NET which is a
controlling instrument showing key success factors in a balanced
scoredcard view. There are departments in an hierarchical structure
and it is possible to agg... more >>
RollUp
Posted by Simon at 11/20/2003 3:51:38 PM
I'm using the rollup operator to show the data and summarize them.
Example:
Select
product_id,product_name,sum(quantityWeek),sum(quantityMonth),sum(quantityOrd
er) FROM products....
group by product_id,product_name with rollup
Now I get the 2 rows of summarized data, one for product_Id and... more >>
How to get data from AD into SQL table.
Posted by CD at 11/20/2003 3:43:30 PM
Not sure what group to start in, so giving this one a try.
I what to get data from Active Dir. and use in sql applications. My goal is
to get users info from AD and place in a SQL table. I tried an exmple using
this:
sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces',
'ADSDS... more >>
Stored Proc and Updateable Recordsets
Posted by Michael Tissington at 11/20/2003 3:23:20 PM
Can an SQL Stored Procedure return an updatable recordset and if so, how?
THanks!
--
Michael Tissington
http://www.tabtag.com
http://www.oaklodge.com
... more >>
Passing long string from C# to a Stored Procedure
Posted by Shadab at 11/20/2003 2:35:39 PM
Hi Everyone,
I am not able to pass strings of size more than 32767
characters from my C# code to stored procedure.
SqlCommand.ExecuteNonQuery() is throwing SQLException with
the Message -"A severe error occurred on the current
command. The results, if any, should be discarded."
Is the... more >>
Profiler message
Posted by JakeC at 11/20/2003 2:30:57 PM
In Profiler i see lot of messages
sqlbatchcompleted:
SELECT N'Testing Connection...'
Application:
SqlAgent Alert Engine
will these cause any performance degrade.
Thanks... more >>
Ordering Rows based on Values in a column
Posted by Gerry Viator at 11/20/2003 1:56:12 PM
Hi all,
IsProcedureModule Column will only contain a possiable of 3 values
('Blank','yes','no')
I would like to Select all rows ordered by the value 'no' first, then
'Blank', then 'yes'
can someone please help.
CREATE TABLE [ModuleList] (
[ModuleID] [int] IDENTITY (1, 1) NOT NULL ,
... more >>
SP to set ListBoxRowSource valuelist
Posted by Filips Benoit at 11/20/2003 1:47:13 PM
My SP returns 0 and should return 14;20;12;55;99;1255;589;66; as rowsource
for a listbox that shows the count of orders per phase.
instance = set of phases ( @RowSource = '14;20;12;55;99;1255;589;66;' = for
an instance having 8 phases)
@CountPhases = number of phases in this instance
Tha... more >>
should I use FREETEXT
Posted by shank at 11/20/2003 1:38:48 PM
I have 3 tables....
Main table is [Stock] which contains columns [ItemNo], [Description],
[Type], and other columns..
1st Related table is [Songs] which contains columns [ItemNo], [SongTitles],
[Singers], and other columns..
2nd Related table is [Equipment] which contains columns [ItemNo],
[Fe... more >>
SQL Server EM - design table - YES or NO output rather then -1 , 0
Posted by Zak at 11/20/2003 1:38:33 PM
Hello,
I cant seemt o figure out how i can output a YES or a NO
value rather then the standard -1 or o output. I have a
table in SQL server and unlike access 20oo were i can
actually selected from the list of output to be YES or
no....
but in SQL server, the data type to select from i... more >>
xp_cmdshell
Posted by culam at 11/20/2003 1:28:38 PM
How can I execute xp_cmdshell from remote location?
Thanks
culam... more >>
Urgent help with sequel statements please.
Posted by Lam Nguyen at 11/20/2003 1:25:13 PM
How can I delete the following information and keep the
records that I need. Please refer to result want.
Thank you very much.
if exists (select * from dbo.sysobjects where id =
object_id(N'[Test]') and OBJECTPROPERTY(id,
N'IsUserTable') = 1)
drop table [Test]
GO
CREATE TABLE [Te... more >>
Transitive dependecy and third form
Posted by Benjamin at 11/20/2003 1:10:57 PM
Hello,
Can somebody explain to me what transitive dependecy is? I
know in textbook they are explain very dry and I find
difficult. Mr. Celko are you there?
Thank you very much
... more >>
Server and Instance Name
Posted by JakeC at 11/20/2003 1:07:11 PM
how can i get server and instance name using tsql.?
... more >>
sp_spaceused how does it work ?
Posted by ljbx at 11/20/2003 1:06:38 PM
Hi,
i have make a copy of sp_spaceused in sp_toto ( in master database ). When i
execute sp_toto in other database, i have not the same results as
sp_spaceused ( sp_toto always get the master.dbo.sysfiles ).
I don't understand why ?
Could you help me please ?
Sorry for my english.
regards... more >>
Trigger status
Posted by R. Ajay at 11/20/2003 12:49:32 PM
Hi ,
Is it possible to see the trigger status whether it is enabled or disabled .
Regards
Ajay
... more >>
Even and Odd days..
Posted by Brett at 11/20/2003 12:26:22 PM
I am trying to figure out a way to determine if the
current day is an even (2,4,6) or an (3,5,7) odd day.
Please advise...
Thanks,
Brett
I am using sql server 2000
... more >>
SQL Server bug?
Posted by Brandon Lilly at 11/20/2003 12:22:15 PM
I thought I would post this here before I open an incident with
microsoft. Perhaps there is something that I was not aware of.
The issue resolves around passing in the DEFAULT value for a scalar
UDF. When I put the scalar function in some queries, it misbehaves by
returning the value 0 (zero... more >>
eliminate column header and space delimited in the result.
Posted by culam at 11/20/2003 12:02:24 PM
HI,
With in ISQL, I can choose not to displace Report Header
and space delimited between field at my machine. However
I would like the user(other developers) to run the queries
without displaying the Header and space delimited between
fields? Can I do it in TSQL?
culam... more >>
Can ISNUMERIC() be used within WHERE clause?
Posted by Grok at 11/20/2003 11:59:48 AM
Col1 (varchar)
---------
111
222
333
ABC
4DD
SELECT *
FROM T1
WHERE ISNUMERIC(Col1)
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ')'.
How do I use ISNUMERIC within a WHERE clause? I'm joining two tables,
but only where a certain column is numeri... more >>
Need help writing a trigger
Posted by Sam at 11/20/2003 11:57:07 AM
Please find the necessary SQL scripts to generate a small version of my
database and some data at the bottom of this post.
Here's a short description of what the database is all about: It's a project
tracking and management system. Contracts go into the tblDeals table.
Because each project may... more >>
Data Import
Posted by KenB at 11/20/2003 11:36:08 AM
I need to import data into SQL that has been collected from a clinical study. In most cases I could handle that pretty easily, but this data is stored on a network drive, each record in an individual Word (.doc) file. Each file was created with a template, so the data should always be in the same ... more >>
Empty message in Raiserror function for special language
Posted by Micha³ at 11/20/2003 11:27:56 AM
Hello all,
I have multilanguage application used MSDE.
I've added messages for three languages using sp_addmessage.
All of messages have format clauses.
I've checked for all languages.
When I set other then us_english languages I haven't message text.
If I delete format clauses... more >>
Transacion log and maintenence plan
Posted by stuart at 11/20/2003 11:19:23 AM
Hi,
have inherited a server that contains about 250 databases. All of these
databases are backed up by a single maintenence plan. This is fine except
the transaction log just keeps growing and growing. All dbs are in Full
recovery mode.
Part of the plan does the back up of all databases.
... more >>
How to replace NULL with blank in the output?
Posted by culam at 11/20/2003 10:44:33 AM
my output have a lot of NULL, I would like to replace it
with blank.
Below code does not work!
REPLACE(ms_loan_adjustable_payment.index_cd, NULL, '')
Please help and thanks in advance,
culam... more >>
OSQL Problem
Posted by Vad at 11/20/2003 10:43:05 AM
Hi,
When i try to execute this line :
EXEC xp_cmdshell OSQL -S server -U Sa -P password -d DB1_SQL -i
C:\SQLScript\ConfigurationTestIntegrationDisplayOnlyAddition.sql
i keep getting same error message :
Cannot open input file -
C:\SQLScript\ConfigurationTestIntegrationDisplayOnlyAddit... more >>
BUG: case function worked incorrectly
Posted by Roman S. Golubin 1709176985 at 11/20/2003 10:29:57 AM
Hi everybody!
This code:
select
case cast(2*rand() as int)
when 0 then 0
when 1 then 1
when 2 then 2
when 2 then 3
end
evaluated by SQL preprocessor to:
Compute Scalar(DEFINE:([Expr1000]=
If (Convert(2*rand(NULL))=0) then 0
else If (Convert(2*rand(NULL))=1) then 1
else If (Conve... more >>
openxml
Posted by Mullin Yu at 11/20/2003 10:17:36 AM
Hi,
I want to insert record into SQL Server by using openxml, but some values
wanted to pass values not from the xml string. is it possible,
say JobID and XMLRequest.
I want to pass values from the incoming parameters fo stored procedure.
Thanks!
ALTER procedure procMultiInsert (@d... more >>
SQL statements help please.
Posted by Lam Nguyen at 11/20/2003 9:54:52 AM
Please help me with the follwowing queries. Here is the
business rule and result want.
Thank you very much in advance.
if exists (select * from dbo.sysobjects where id =
object_id(N'[Test]') and OBJECTPROPERTY(id,
N'IsUserTable') = 1)
drop table [Test]
GO
CREATE TABLE [Test] (
... more >>
invalid object name error
Posted by Holly at 11/20/2003 9:38:25 AM
I have a user_defined_function and a stored procedure
that calls the function. They both compiled fine (not
debug yet). But When I try to run the stored procedure, I
got the error says "Invalid object
name 'dbo.ARMS_FindLevels'.
Attached are the function and the stored procedure.
CREATE... more >>
Moving data type text
Posted by Sam at 11/20/2003 9:38:16 AM
I need to transfer data from one table to another. I am
having problems transferring the data inside columns
defined as "text".
I need to move Table1.TextData1 to Table2.TextData2.
Any help would be appreciated.
Sam... more >>
How to get all accessable SQL servers?
Posted by dancingbead at 11/20/2003 9:26:26 AM
I want to get the list of all accessable SQL servers as
the list of servers provided by MS SQL SERVER SERVICE
MANAGER Dialogue box.
thanks.... more >>
In flight concurrent query - how to count?
Posted by John Gunvaldson at 11/20/2003 9:06:07 AM
Q? How to count in-flight concurrent queries with SQL 2000
We are working with www.wintercorp.com to publish our database information for their annual contests. They are insistant that we be able to produce a count of "In-Flight Concurrent Queries" against a database. Research on google shows that... more >>
Query Help
Posted by George Durzi at 11/20/2003 8:45:04 AM
Consider my table (simplified) that stores my wine bottles:
create table WineBottle
(
BottleName varchar(50),
GoodtoDrinkAfter int,
GoodtoDrinkBefore int
)
INSERT INTO WineBottle ([BottleName], [GoodtoDrinkAfter],
[GoodtoDrinkBefore]) VALUES('Bottle1', 1998, 2005)
IN... more >>
create text file from TSQL
Posted by culam at 11/20/2003 8:42:40 AM
Can I create a text file at specific location from TSQL?
Thanks,
Lam... more >>
Performance question: how much data to return for an exam?
Posted by go559 NO[at]SPAM hotmail.com at 11/20/2003 8:37:07 AM
This is somewhat of a general design question, so I have no DDL to
post. I am creating an exam , with potentially 100 questions. Each
question has 4-5 choices.
Traditionally, I've joined the "Question" table and "Choice" table on
some id like questionId, and then retrieved the recordset. As ... more >>
Problem with IN and comma delimited string variables. Please help.
Posted by WayneS1068 NO[at]SPAM yahoo.com at 11/20/2003 8:33:53 AM
I'm going to be creating a stored procedure which will be taking in a
comma delimited string as a parameter. In short, I want to return
records that match the values passed in. However, I can't seem to get
it to work.
Here's my sample table:
create table names
(
fname varchar(30... more >>
Gaining Exclusive Access
Posted by brian at 11/20/2003 8:09:31 AM
I was recently restoring a database on our live server
with sql2000. An error said I didn't have exclusive
rights. The only way I know to get around this is to
detach the database, clear connections, and attach the
database.
Is there code to kill all spid's and give me exclusive
rig... more >>
retrieve COLUMN names based on content......
Posted by Sean McPoland at 11/20/2003 7:26:39 AM
Hi,
I have two tables A and B
Table_A = col, colA, colB...
Table_B = colA, col1, col2, col3, col4.....
therefore Table_A has reference to Table_B via colA.
what i am trying to do is.....
select Table_B_column_names_as_data
from Table_B
where Table_A.colA = Table_B.colA
and T... more >>
Query is slower in SQL Server then Access?
Posted by Deke at 11/20/2003 7:25:20 AM
Okay this is the first time I have run into this.
I have a program that I have recently converted over to
SQL Server 2000 from Access 2000.
I have this complicated query that takes about 7 seconds
to run on the Access version and it takes 14 seconds in my
converted to SQL version.
Th... more >>
Table Design...
Posted by John Damus at 11/20/2003 7:01:18 AM
Hi,
I will be having a pop-up questionnaire, and I was
wondering if anyone can give me pointers on the table
design.
1)Number of children in household:
2)Name of Children in household:
3)Birth Date of Children in household:
4)Gender
What do you guys think? What type of table desig... more >>
MDF and LDF File
Posted by John at 11/20/2003 6:54:27 AM
I had a SQL database file in my hard drive: it is called jinuacademy.
However, two days ago, my computer crashed, and I barely made to recover old
files I have had in my computer. Actually, I had another hard drive, and I
switched my original hard drive and new hard drive, and installed Windo... more >>
Why is the IsMsShipped bit set?
Posted by Gurba at 11/20/2003 5:53:28 AM
Hi,
I just created a procedure on my sql2000 server, and noticed that the
"IsMsShipped" bit is set.
How come?
I thought this bit was supposed to help distinguish the system object from
the user objects?
regards... more >>
Creating a file from a SQL Statement
Posted by Julie at 11/20/2003 5:51:45 AM
Hello,
Can anyone advise on the best way to create a file from
running a SQL Statement that does not use DTS ?
The reason why not DTS is there is a lot of control and
add character used as the column and row delimeter that
DTS doesn't like.
Thanks
J... more >>
Prefix database name flexability
Posted by Stuart Dee at 11/20/2003 5:44:04 AM
Hi,
I have an Audit Database say A
Which has stored procedure calls to another Database say x
So in A
It might call
x.dbo.myStoredProc
There could be multiple x's or x could be called something
else
is there anyway of flexable programing A for the name
Prefix of x or whatever its ca... more >>
Warnings in Query Analyser and the resultset is suppressed
Posted by John Rajendran at 11/20/2003 5:18:37 AM
Hi there,
I have a Stored Procedure called SP1 which gives a select
* from ##temptable (this is the return value from the
SP1). This ##temptable has a warning in the creation
itself. The Warning message is row size exceeds the
maximum size etal... and then the Stored Procedure doesnt
retu... more >>
Help with substring'ing in numbers-field
Posted by Mirador at 11/20/2003 5:16:19 AM
Hi..
The problem is that i got a numberfield (fnr - 11 numbers) where i want
to see if number "7" in the field is either got value 8 or 9. Gonna
build it into a view.
I figured out i cannot use substring like this :
SELECT fnr from table where substring(fnr,7,1).
What other ways can i d... more >>
SELECT INTO alters value?
Posted by hansje at 11/20/2003 4:37:22 AM
Hi there,
I'm using a SELECT name, city, dateofbirth INTO ##tmpTable.
Some of the dateofbirth (defined as datetime) have a value of 0:00:00.
After executing SELECT INTO statement, those values of the dateofbirth
in the #tmpTable have changed to the value 1899-12-30 00:00:00.000
I recognize th... more >>
Set RowCount with variables
Posted by Muhammed Fawzy at 11/20/2003 3:21:44 AM
hello,
I have a problem when trying to call
Set RowCount @LocalVariable from a user defined function
It Generate the following error message.
Invalide use of UNKNOWN TOKEN in the function
I Thought of using Top instead but i want to set the row
count at run time by a variable pass... more >>
Question for counting all groups and subgroups
Posted by Kenneth at 11/20/2003 1:46:13 AM
I have got 2 tables. The donors table and the business type table
<<Business_Type>
Business_Type_ID, Parent_ID, Business_Des
1, 1, ‘A Typeâ€
11, 1, ‘Subtype of Aâ€
2, 2, ‘B Typeâ€
3, 3, ‘C Typeâ€
13, 3, ‘First subtype of Câ€
14, 3, ‘Second subtype of Câ€
15, 15, ‘D Typeâ€
16... more >>
everything before the @
Posted by shaun at 11/20/2003 1:44:11 AM
Hi I have a column with email addresses but I want to
select the name before the @ sign and output only this
data does anyone know of a way to do this thankyou for any
help
Shaun... more >>
|