all groups > sql server programming > november 2005 > threads for wednesday november 2
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 SQL query help, please !
Posted by Alex Nitulescu at 11/2/2005 9:17:38 PM
I have a table which is as follows: (Grouped by TY/LY, TransactionType,
Store, Category and Subcategory) - (TY/LY stands for ThisYear/LastYear)
TYLY TransactionType Store Category Subcategory Amount
-----------------------------------------------------------------------
2005 ... more >>
Design Problem
Posted by Suparichithudu at 11/2/2005 9:10:02 PM
Hi Gurus
I have seen a desing like this. I found the following problems(?) but I want
comments of Gurus
1)There are four sourse databases(all sql server) and that data is staged
using .exe into another database in another location. This .exe runs windows
bach and inserts data at particul... more >>
Returning 2 values from the same table
Posted by nsajus NO[at]SPAM yahoo.com at 11/2/2005 8:19:51 PM
Hi,
I have a strange problem.
I have 2 tables
Table1 called tblUser contains columns UserID, FirstName, LstName
Table2 called tblMemos contains columns MemoID, FromUserID, ToUserID,
MemoNote.
The FromUserID and ToUserID are kind of like foreign keys to UserID in
tblUsers
I want t... more >>
How to get field value from a dynamic table in stored procedure
Posted by debussy NO[at]SPAM gmail.com at 11/2/2005 5:55:37 PM
In my stored procedure,I want get some fields' value from a dynamic
table,something look like below:
PROCEDURE GetFileds
(
@Field1 INT,
@Field2 VARCHAR(255),
@Table VARCHAR(255)
)
AS
--I want to get two fields from table which's name was passed by
paramerter.
SELEC... more >>
Joining two large queries as derived tables
Posted by dpless NO[at]SPAM gmail.com at 11/2/2005 5:32:42 PM
All,
I want to join two large queries together keying on a common column. I
have simplifed the queries / derived tables; but I am trying to do
something like what I have below. How do you join two derived tables?
SELECT * FROM
(SELECT Name AS 'Name1', ... other columns
FROM [TABLE1]) AS ... more >>
Help with Structure for New Database
Posted by Drew at 11/2/2005 4:49:34 PM
I need some help with creating structure for a new database. Here at work,
we have what is called an AIMR (Account Initiation/Modification Request).
This AIMR is used to grant/deny/modify permissions for a certain person.
This system has been very hard to keep control of, because of the probl... more >>
Divide By Zero in the Where Condition
Posted by kannan at 11/2/2005 4:35:07 PM
Hi All,
In my SQL I have Where Condition is as follows
Select * From Table1....
WHERE StatusDate BETWEEN '01-jan-2005' and '01-Mar-2005'
And (100 - (Price/MarketValue *100)) > abs(10))
But some of my MarketValue in the table having zero values, I am getting
following error message.
... more >>
executing a DTS package
Posted by Earnie at 11/2/2005 3:16:01 PM
a scheduled DTS package on a commercial server fails to execute, to transfer
data between two databases that I own.Can I trigger the package to execute
from code within a stored procedure ?
thanks in advance Earnie... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
SQL Server SmallDateTime Problem
Posted by RichardF at 11/2/2005 1:58:43 PM
I have a problem with SQL Servers behaviour with smalldatetime
columns.
Create a table in SQL Server withone column of type smalldatetime.
Insert four rows with the following values in the column, 10/24/05,
10/25/05, 10/26/05, 10/27/05.
Using Query Analyzer run the following query...
S... more >>
Select records with sequential numbers
Posted by RJ at 11/2/2005 1:52:08 PM
Is there a way to construct a select statement that will also produce
sequential numbers? Let say that I have a table with two fields, name and
city. When I use the select statement to retrieve names in a specific city, I
want to see the following results:
Seq. Number Name
1 ... more >>
Retrieving row parameter from query
Posted by hardik at 11/2/2005 1:50:44 PM
Hi,
I have a table arc_emp where there is a unique key on id(which is also
a primary key) and timestmp (which is timestamp). Suppose the rows are:
id ............timestmp
1 .............'2005-01-01'
2 .............'2005-02-01' etc.
Now I want to duplicate the records. i.e after duplica... more >>
Could you please help me?
Posted by Xiaoshen Li at 11/2/2005 1:23:38 PM
Dear All,
I have taken SQL courses three years ago and I have not use it since
then. Right now, I ran into a question. I am wondering if you could
kindly help me out:
There is a table with student_ids('sid') and professor_ids('pid'). Each
student can only have one professor as a mentor a... more >>
SQL Agent
Posted by Microsoft at 11/2/2005 1:20:54 PM
Is it possible to schedule a job that runs a script via http?
If yes how can I do that?
Thanks
... more >>
Permission error on transfer to protected Excel worksheet
Posted by Gerald Hopkins at 11/2/2005 1:17:18 PM
I am new to the forum and hope this issue is in the right place.
I have a SQL query that is transferring data from a SQL table to an Excel
spreadsheet on the same machine. I keep getting the following error unless I
unprotect the worksheet. I don't want to expose the unprotected worksheet to ... more >>
for each record updated
Posted by alacrite NO[at]SPAM gmail.com at 11/2/2005 1:14:04 PM
Currently in my database I have Widgets. These Widgest can be linked
together through keys in a Link table. Think in terms of hierarchy. A
parent Widget has child Widgets linked to it. These child Widgets when
linked take on properties(field values) of the parent Widgets. I have a
trigger that ... more >>
delete from table
Posted by Johnny Ruin at 11/2/2005 12:39:50 PM
Every night my application executes a 'delete from table1', and I
refill the table with new data. After a few weeks running, the table
queries get extremely slow. I can speed things up by deleteing the
database and recreating it. It seems likely that I'm missing some
sort of key maintence ... more >>
Mass Import of data into Sql 2000
Posted by Brandon Owensby at 11/2/2005 12:39:18 PM
I am working on a project that involves importing lots of data into SQL 2000
from an Access database. One of the tables that I am importing is atleast
95% of the total data being imported. Its 1,600,000 records. Not only is
it 95% of the data being imported..if not more...its atleast 90% of... more >>
Help with query that only returns filds with certain characters
Posted by Star at 11/2/2005 12:29:57 PM
Hi,
I need to write a sql statement that only returns records if
a certain field DOESN'T contain a letter between a and d, a number, a #,
and a asterisk. If a different character is found there, it should
return that record.
For example. If we have these records
1. 43242#
2. %3499
3. ... more >>
Accessing Excel functions in SQL SP
Posted by ram4tech at 11/2/2005 12:22:01 PM
Hi,
I am trying to access an Excel function in a stored procedure. First of all,
is it possible, if it is, can someone give me an example.
Thank you.
--
Ram... more >>
Select Distinct
Posted by JMB at 11/2/2005 12:13:49 PM
select city, title from employees -- 9 employees
select distinct city, title from employees -- 7 employees
--How can i get a result which is the first query minus the second -- 2
employees
--I mean, return the rows which aren't in the second result?
tks,
JMB
*** Sent via Developersdex ... more >>
Any SQL equivalent of InStrRev()?
Posted by Bob at 11/2/2005 11:46:56 AM
In VB, there's a string function called InStrRev() which returns the
position of an occurrence of one string within another, from the end of
string.
I have a column containing data such as "/uploads/encrypted/design1.doc". I
want to be able to extract the pure filename from this column (e.... more >>
Replication - Mirroring - Clustering?
Posted by Raymond D'Anjou at 11/2/2005 11:38:04 AM
Hi,
I'm not the network guy, just asking the question for him.
Here's the scenario:
We manage our own server and have a SQL 2000 database.
All database transactions are done through our website.
What the boss wants:
If one of the servers goes down, database server or the IIS server,
every... more >>
SQL2005 Embedded
Posted by simon at 11/2/2005 11:18:42 AM
I need embedded database in my exe program, something like myBase or
Firebird,...
I heard that SQL2005 has the support for that.
Any links,examples, suggestions ?
regards,S
... more >>
sysindexes table status = 0?
Posted by S at 11/2/2005 11:16:04 AM
I have an entry in sysindexes table with the name of the table name and
status = 0 and indid = 0 . What does this mean?
... more >>
Bulk Insert question
Posted by Bob at 11/2/2005 10:41:01 AM
Hello,
I use the following statement to insert a string of 35 characters into a
table (I am planning to figure out a suitable .FMT file for parsing this into
the right column definitions, but that is after I figure out this current
problem described below)
BULK INSERT MyTestTable FROM ... more >>
Method/Definition inside T-SQL
Posted by Just D. at 11/2/2005 10:39:53 AM
Did anybody hear if it's possible to define something like a
method/function/macrodefinition inside T-SQL? Particularly I have a few
SELECTs inside one T-SQL script and in most of them the WHERE CLAUSE is
absolutely same, but the retrieving results should be different and
according to these ... more >>
EXISTS Clause behavior
Posted by Alan Samet at 11/2/2005 10:26:54 AM
I'm not posting the table schemas here because I don't believe they're
relevant to the issue at hand. I've written the following function to
perform a security check. I believe it to be syntactically correct;
however, SQL Server is having trouble resolving a table reference in my
query. Any thou... more >>
sp_trace_setstatus - How Do I know which SPID is running the profile Trace?
Posted by William F. Kinsley at 11/2/2005 10:05:14 AM
I am using SQL to create a profile trace (for performance reasons) and
sometimes it takes it awhile to shut down. Is there a way know which SPID
is running the trace?
Thanks,
William F. Kinsley
Sr. Design Engineer
NextGen Healthcare Information Systems Inc.
... more >>
Index on foreign key [newbie] ?
Posted by Jules Winfield at 11/2/2005 9:53:32 AM
Hi,
I need to track which modules a user is able to access. I'm designing a
table called UserPermissions which suits this purpose, where the columns
are:
ID int
UserID int
ModuleID int
AllowDeny bit
UserID is a foreign key which points to the "ID" ... more >>
Capture new and modified data
Posted by culam at 11/2/2005 9:34:05 AM
Hi,
I have two tables, 1 is yesterday data and 1 is today data.
My job is to identify new and modified data only.
I am thinking of compare data, field by field in the where clause to
identify change.
Is this the best way to do it?
Thanks,
Culam... more >>
Best Technology for Reporting.
Posted by Mark at 11/2/2005 9:21:42 AM
Current Environment:
SQL 2000 SP4 EE on Windows 2003 SP1
I need some suggestion on some of the currently available options for
reporting.
We have a transactional database where lots of transactions come throughout
the day. Some of the tables can have over 200 k records added. We need to ... more >>
Convert datetime
Posted by Patrice at 11/2/2005 7:29:10 AM
How can I easily convert two columns in a table to a single datetime column:
the columns look like this:
Date_In
19990220
20000114
19980524
Time_In
1304
0237
1503
I should also add that these columns are of varchar data type since the
source data is a text file.
Thanks!... more >>
Space and nvarchar column
Posted by milly at 11/2/2005 7:09:01 AM
Hi all!
I have to insert a "space" in a column with nvarchar datatype, when I do it,
I don't find the single space, but..nothing.
Any idea?
thanks!
milly... more >>
Change Column Ordinal Position with T-SQL
Posted by bill_morgan at 11/2/2005 6:59:06 AM
Hi Friends ...
I need to change the ordinal position of a column in an existing table using
T-SQL through QA - anybody know the proprer syntax?
Thanks for your help ...... more >>
refrence
Posted by bijan at 11/2/2005 6:49:03 AM
hi
i am new in sql .could you direct me a web site that learn sql
thank you... more >>
How to check for keywords?
Posted by Frank Hardy at 11/2/2005 6:25:03 AM
Using SQL Server 2000 from .NET I have to use names for tables and columns
which are defined at runtime. I do not (and do not want to) use quoted
identifiers, but I want to display clear error messages to the user.
Therefore I need to check if a given name is a reserved keyword (for SQL,
OD... more >>
how to - table join - either this column or that
Posted by Duke Carey at 11/2/2005 6:00:05 AM
Disclosure - I use SQL Server/MSDE occasionally to work with data sets too
big for Excel
In some lengthy (for me, anyway) queries, I'd like to join two tables -
HoldingCompanies and CurrentPending - but in some cases they will join on
h.HC_Key = c.CurrentHC
other times on
h.HC_Key = ... more >>
Access Hangs on "Delete *" from linked table
Posted by Ari at 11/2/2005 5:40:27 AM
I have a table called TKSD0UJA in my sqlserver that access links to.
The codes is:
strSel = "DELETE * FROM [TKSD0UJA];"
db.Execute strSel
it hands on db.Execute. I checked permissions within the sql server and
I have delete permission. Is there any reason why it should hang?
... more >>
Strange behaviour of query
Posted by nj at 11/2/2005 4:49:05 AM
Hi All,
I am facing very strange problem with one query. The query is generated by
the application
itself(adhoc query). This query is combination of 3 queries. If we execute
all the 3 queries seperately say D1,D2 and D3.
Then query D1 gives 13 records
query D2 gives 6 records
query D3 giv... more >>
Which style for "if exists" is better
Posted by parasada at 11/2/2005 1:36:06 AM
one of my DBA friends sometime back was mentioning that it is a good practice
to write something like this for checking existence of data:
if exists (SELECT 1 FROM table WHERE cond)
instead of
if exists (SELECT * FROM table WHERE cond)...
will there be any benefit from using one style ove... more >>
Dropping the time
Posted by Enric at 11/2/2005 12:54:07 AM
Dear all,
DDL:
CREATE TABLE [CRM_ServAplAgrupada] (
[CRM_Servidor] [varchar] (25) COLLATE Traditional_Spanish_CI_AS NULL ,
[CRM_Aplicacion] [varchar] (25) COLLATE Traditional_Spanish_CI_AS NULL ,
[CRM_Peticiones] [int] NULL ,
[CRM_Fecha] [datetime] NULL
) ON [PRIMARY]
GO
Well, I've g... more >>
Unicode problem
Posted by SoccerManic at 11/2/2005 12:00:00 AM
Hi,
I have a table storing some Chinese and Japanese characters, the datatype is
NVarchar.
My problem is, after exporting the data into text file and then import them
into another tables with the datatype set to NVarchar, the characters are no
more in Chinese or Japanese, they turned into ... more >>
Compatibility problem SQL 2005 <-> SQL 2000
Posted by Klaus8812 NO[at]SPAM community.nospam at 11/2/2005 12:00:00 AM
I use the following sql 2000 query:
Delete otherdatabase..table
From table Join otherdatabase..table on table.DSN =
otherdatabase..table.DSN
Where otherdatabase..table.TOUCH <= table.TOUCH
The table structure of "otherdatabase..table" and "Table" are the same.
The query works fine ... more >>
INSERT multiple record statement
Posted by Man Utd at 11/2/2005 12:00:00 AM
Is it possible to insert multiple record by something like:
INSERT INTO table1 (name, fax, phone)
values ('John', '1800 000', '1900 900'),
('Mary', '1100 000', '1300 900'),
('Peter', '1200 000', '1400 900');
... more >>
avoid cursors.
Posted by ichor at 11/2/2005 12:00:00 AM
hi what are ways of avoiding cursors?
my boss told me to use derived tables. any other tricks i can use?
... more >>
Loop through all User Tables
Posted by Graham Smith at 11/2/2005 12:00:00 AM
Hi,
I would like to execute a sql statement on all user tables of my db. Do you
know how to script that this statement loops through all user tables?
Thanks in advance
Graham Smith
... more >>
question
Posted by ichor at 11/2/2005 12:00:00 AM
hi what is the difference between
select * From a
inner join b on a.id = b.id
and b.col1 is null
and
select * From a
inner join b on a.id = b.id
where b.col1 is null
this gives me different results.
why?
... more >>
Construct datetime value from seperate date and time
Posted by Stephan Zaubzer at 11/2/2005 12:00:00 AM
Hi there...
I have the following problem:
After upgrading an old Access Database to SQL Server a table contains 2
datetime fields of which the first one contains the date (and the time
is simply 00:00:00) and the second one contains the time (and the date
is 1899-12-30). As you can probably ... more >>
query
Posted by ichor at 11/2/2005 12:00:00 AM
create table a
(
i varchar(10),
j varchar(11)
)
create table b
(
n varchar(10),
m varchar(11)
)
insert into a values(null, '1')
insert into a values(null, '2')
insert into b values(null, '3')
insert into b values(null, '4')
insert into a values('val1', '5')
insert into... more >>
|