all groups > sql server programming > july 2006 > threads for friday july 14
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
sql query copy database
Posted by Howard at 7/14/2006 10:03:12 PM
I have two databases, both have a table with the exact same structure. i
would like to merge the two databases, copy TABLE from database2 to TABLE
database1 where ID column in database2 > 400
thanks
Howard
... more >>
SQL Query help
Posted by Don Khan at 7/14/2006 9:46:46 PM
Hello,
I'm having a bit of problems getting the following done in sqlserver 2000; I
have a table with the following fields:
ClientID | FileName | Revision | LocalPath
===================================================
27 | C:\xxx\layout.xml | 2 | C:\filepath1
23 ... more >>
VS 2005 Standard Edition
Posted by Joe Delphi at 7/14/2006 9:39:23 PM
Hi,
I want to debug a stored procedure. I am using Visual Studio 2005
Standard Edition and SQL Server 2005 Express. I open the stored procedure
but it will not let me set a breakpoint. I can see menu items with terms
like Toggle Breakpoint, but they are grayed out.
Does t... more >>
turn table sideways...
Posted by rodchar at 7/14/2006 8:31:02 PM
hey all,
i have a small table that looks like the following:
gender/age
-------------
male 18
female 32
male 40
female 25
female 26
female 30
how can i store or display horizontally like the following:
the count for each gender in respective age categories
... more >>
querying multiple tables
Posted by chentiangemalc at 7/14/2006 8:00:02 PM
Hi,
I'm wondering if anyone can offer some advice in how to write a query for
this type of instance:
The data I am looking at is in a table with columns as follows:
dbo.data: id, time, value, quality
This id value links to another table...
dbo.atoms: id, uuid
Then this table is l... more >>
Triggers
Posted by Brent Stevenson at 7/14/2006 7:59:11 PM
I need a method to initiate an external process (a Business Objecs report)
once a SQL table is updated. Do triggers provide a means to perform this? If
not is there anything else SQL related that does?
... more >>
Disconnected rowsets
Posted by Robert Bravery at 7/14/2006 7:11:40 PM
HI all,
I was wondering HOW DBA's handle things like this.
Here is a scenario, simlpistict but real. Also multipl this by as many as
you want to understand the potential proble,m
A few salesman on the road, each with some kind of mobile device. THey are
not conencted to the company database, ... more >>
Managing Multiple Servers
Posted by Brian Shannon at 7/14/2006 5:35:11 PM
I am using sql server 2000 at 3 seperate properties. Each property is
treated as it's own but many times I am required to perform a combined
analysis. I am not a DBA nor do we have a DBA but I am fairly knowledgable
at how to get around. Each server runs the same version of a 3rd party
ca... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
CREATE TABLE Defaults have double passwords
Posted by Dr. Network at 7/14/2006 4:43:58 PM
SQL 2005, Service Pack 1 using SSMS:
I'm creating a table with default values for the columns. When I create =
the table, there are no parentheses around the default values. Then when =
I script out the table using SSMS, the default values have a double set =
of parentheses around them. Furthe... more >>
illegal characters
Posted by JTL at 7/14/2006 4:42:42 PM
is there a function in sql server that will check a string for illegal
characters? i have a column that sometimes contains values like:
? ???¦++++S+n¦÷+¦ú¼-·+½+-+-¦p++¦÷¦÷¦-ú+ú¼-¦°-«¦+¦«¦-+¡--+++Ñúí+¦
i want to clean this table by deleting records that have these types of
characters- does t... more >>
How to get the record created date?
Posted by tcw at 7/14/2006 4:15:23 PM
How do I delete rows that are older than 180 days if the table does not
contain a column of timestamp? The following statement works fine if
parameter startdate is known:
DELETE From MyTable Where DATEDIFF (day, startdate, GETDATE()) > 180
Thanks in advance.
-tc
... more >>
Sql 2k UDF help
Posted by Fabri at 7/14/2006 3:07:58 PM
I don't understand why in this UDF:
=======================================================================
create function dbo.MyUDF(@dove varchar(100))
returns varchar(8000)
as
begin
declare @out varchar(8000)
set @out = ''
return
(
select @out = @out + ';' + TC.name
from
... more >>
subquery inside select to concatenate results ?
Posted by mdscorp at 7/14/2006 2:50:21 PM
this code works fine
DECLARE @st varchar(100)
SELECT @st=@st+service.status FROM service WHERE service.id=@ID
SELECT @st will display all data in the status field just concatenated
Now, i wonder if i can do this
SELECT a,b,c,(SELECT @st=@st+service.status FROM service WHERE
service.id=... more >>
please help on count(distinct <expression>)
Posted by Carlos at 7/14/2006 2:44:48 PM
Hi all,
the sql parser does not like when trying to execute a query that
has more than one column to be distinct within the count function.
i.e.
select count ( distinct a.ssn, a.term ) from
mytable
when I just leave one column (i.e. ssn), the count is executed normally,
but ... more >>
Returning records updated
Posted by David at 7/14/2006 2:31:32 PM
I want to return the # of records updated and I was thinking of using the
following SP. Will this work on SQL 2000 or 2005? Thanks
CREATE PROCEDURE [ms_updROProblemCount]
(@RecordID [int]
@Processed [int] output)
AS UPDATE [Marshall].[dbo].[RepairOrder]
SET [Problems] = (SELECT Coun... more >>
master table and child table andfield concatenation and loop records ?
Posted by mdscorp at 7/14/2006 1:39:50 PM
i have a main table as in:
tbl_main with field a,b,c,d,e
I have a child table as in tbl_child with fields a,b,c,d
I must go through tbl_main , then for each tbl_main record I must also
find child records related .
at the end I must create a string composed as follows:
tbl_main.a,tbl_main.b... more >>
Red-Gate Log Explorer
Posted by Jason_Williams NO[at]SPAM gensler.com at 7/14/2006 12:16:06 PM
Does anyone happen to know if the folks at Red-Gate used a public SDK
to create the log explorer, or did they fork over money to microsoft to
get a ISV licensed SDK?
I'm looking into making a similar product that would be open source,
and I'm trying to figure out what they used to translate ... more >>
update all columns if exists, or do the insert based on pk
Posted by trame2006 NO[at]SPAM hotmail.com at 7/14/2006 12:02:26 PM
I have base table and temp table with new data. I need to update
changed columns of the base table , if pk exists or do the insert. Any
examples for doing this? The table is having more than 50 columns, I
need to update changed data. I would appreciate any thoughts.
Trame
... more >>
Column permission being ignored by Access Form Combo box
Posted by kellysc at 7/14/2006 11:51:28 AM
I have a table linked to an access mdb which I have set permission on
for a specific set of users to update, delete, etc and another set of
user to only select, but I need these users to be able to change one
other field in the table.
I have set the permissions and all works well, but for some... more >>
Insert using subsqueries
Posted by KatMagic at 7/14/2006 11:49:59 AM
How can I do an insert, pulling data from one table to another, plus add
more values -- if possible?
For instance, I have a client table, with the id field as the primary key.
I have tbl2, that references the id field, plus 3 other fields: Cost, Date,
Comments
I need to do inserts:
in... more >>
SELECT INTO From Result Set
Posted by Jim at 7/14/2006 11:34:53 AM
Hi,
We are using SQL Server 2005.
Is it possible to fill a temporary table with the result set
from a stored procedure? I want to do something like this:
SELECT *
INTO #Bicycles
FROM EXEC(Procedure Name)
Jim
... more >>
sqldbtype.nvarchar in application but field is a varchar in database
Posted by Bill Youngman at 7/14/2006 11:19:04 AM
I have just taken over a project for my current client and have noticed
several places in the existing application where the developer set the sql
parameter dbtype to nvarchar in the application code but the field in the
backend database is a varchar. What effect, if any can this have on the
... more >>
No rows returned
Posted by Mark Boettcher at 7/14/2006 10:54:01 AM
We have encountered a problem where a table has become 'damaged' (for lack of
a better word) such that when we either attempt to perform an update on the
table or do a simple query of 'select * from unit', the queries 'hang'.
However when we look at the properties on that table it says there a... more >>
Trying to avoid a stored procedure, is this possible?
Posted by Russell Verdun at 7/14/2006 10:42:57 AM
I have a single table that has two columns pkID & Notes. For each pkID there
can be several rows, what I would like to accomplish and know if possible.
Is to create a column, that I can number each row for a given pkID
sequentially.
pkID Notes NoteNumber
1 ... more >>
SUM() gone wrong.
Posted by wmureports at 7/14/2006 9:19:31 AM
Ok, so I have a table that looks like this
SessionID CourseID Users
1 10 100
1 10 105
2 15 100
3 20 102
3 20 100
Now what I want t... more >>
need help for a query
Posted by samuelberthelot NO[at]SPAM googlemail.com at 7/14/2006 9:17:00 AM
Hi,
Here are the records :
house
kitchen
room
garage
livingroom
bathroom
I want to do a select that gets all those records ordered
alphabetically (so bathroom comes first normally) BUT house should come
first, and then the other records sorted.
house
bathroom
garage
kitchen
livi... more >>
Question for T-SQL Gurus
Posted by Dave at 7/14/2006 9:05:41 AM
I have a table that relates emails together. I would like to leverage
this information to create a rollup key that can be used to identify
the entire group. Some groups will have one email some will have many.
Is there a way to approach this problem with a set based approach? I
know I can d... more >>
Query returning wrong data
Posted by Peter Newman at 7/14/2006 8:51:02 AM
im running this query as i need to have an index number for a vb.net datset
"Select t1.*, (select count(*) from BossData.dbo.OriginatingAccounts t3
where t3.tblOA_Licence < t1.tblOA_Licence) as IdCol from
BossData.dbo.OriginatingAccounts as t1 Where t1.tbloa_licence = 'TEST' Order
By t1... more >>
VIEW's ORDER BY columns necessary in column list
Posted by Keith G Hicks at 7/14/2006 8:40:18 AM
I recently created a view (based on another view) that has an ORDER BY in it
that is requiring that the ORDER BY columns be listed in the column list
after the view name. This is the first time I've encountered this and am
wondering why they are required to be in the list even though they do not
... more >>
Query help
Posted by HP at 7/14/2006 8:31:02 AM
Below is my view which returns 70,000 + records. It takes like a minute or
more sometimes. How can I make it faster. With time the number of rows are
going to increase and the query will take even longer. Please help how I can
optimise query to make it run faster.
Help is apreciated. Any id... more >>
SET ANSI_WARNINGS OFF: can this be table-specific?
Posted by thatsMaBoy at 7/14/2006 8:07:20 AM
Hi,
I am using SQL Server 2000. I know that it is bad practice to truncate
data as it is lost but please could someone answer the following:
1. Can ANSI_WARNINGS be set to OFF on a table-specific basis, or is it
database-specific? Basically, I want to be able to INSERT/UPDATE
certain tabl... more >>
Table design request for comment. (Help please)
Posted by Mark at 7/14/2006 8:04:17 AM
Hi there gurus, can you please add your 2 cents on this design? We're
having trouble relating these tables in a diagram because of the keys.
Is it necesary to have the references setup? I would assume yes so the
forign keys can be setup.
If you look at this link, you'll see our diagram. In ... more >>
Debugging in SS2005 ?
Posted by Joe Delphi at 7/14/2006 7:36:48 AM
Hi,
In SQL Server 2000, I am used to using the stored procedure debugging
feature in the Query Analyzer to debug my stored procs.
We recently switched over to SS2005 and I am using SQL Server
Management Studio - but cannot figure out how to debug. There don't appear
to be any... more >>
Check if file exists then delete it
Posted by mdscorp at 7/14/2006 7:25:51 AM
I am almost done with my HUGE stored procedure and iowe it mostly to
contributions from all of you guys, THANKS
The last part of the T-SQL coding is I need to check for a file in the
server , delete it before I attempt to re-create it with new data for
the next day, any code for this ?
thanks... more >>
any idea how to decode hex time string '0x01 C6 56 B1 8C EA 40 00'
Posted by chentiangemalc at 7/14/2006 6:21:02 AM
Hi there,
I'm trying to understand a database for which information is not available
concerning how it writes time values.
Here is an example:
Start time: 0x01 C6 56 B1 8C EA 40 00
End time: 0x01 C6 57 7A B7 53 FF FF
I assume it contains date as well, any ideas of how I should go ab... more >>
Need help in writting query....
Posted by Mukut at 7/14/2006 6:10:23 AM
All,
I am eagerly looking for your kind help in a specific problem as
described below:
I have
source table S(suaId,subId), Destination table D(duaPId,dubPId).
Also having tables UA(duaPId,suaId) & UB(dubPId,subId).
while loading data, process takes suaId and looks for it in UA.suaId
c... more >>
Stored Procedure Problem
Posted by Tiger at 7/14/2006 6:00:50 AM
New to SQL and Stored Procedure. Been reading up where I can. Trying to
create a stored procedure that does the following. Reads in a value
from an ASPX dropdown (@SST), reads in a value from a another ASPX
dropdown (@acct_no). Takes the following user input data to the
following fields. Contr... more >>
connect to oracle database
Posted by Xavier at 7/14/2006 5:10:02 AM
hello,
i want to connect to a oracle database. Now in VS2005 whaen i select the
oracle driver i get the message:
System.Data.OracleClient requires Oracle client software version 8.1.7 or
greater.
Must i install a oracle client? ....
Is this free?
Where can i download it?
thanks
F... more >>
decimal (28,2)
Posted by Martin at 7/14/2006 1:51:02 AM
I have defined my decimal fields with decimal (11,2). I have also defined
parameters in VB.Net where I set SqlDBType.decimal without setting a size or
precision ().
When I look at the statement using SQL Profiler, my decimal parameters are
set to decimal (28,2) and (28,0).
Is this so, ... more >>
Mask certain number of a Credit Card Number?
Posted by Marco Napoli at 7/14/2006 1:20:40 AM
I have a VarChar field that stores Credit Card numbers, is there a way in a
SELECT statement to mask certain portions of the Credit Card Number?
For example: 1234-5678-9012 would show as xxxx-xxxx-9012
Thank you.
--
Peace in Christ
Marco Napoli
http://www.ourlovingmother.org
... more >>
General design question
Posted by Daniel at 7/14/2006 1:00:28 AM
Hey guys
I have to do a database for a poker site and it requires storing everything.
I notived other places such as party poker have hand numbers and table
numbers and i presume all these come from a database. However they use
logfiles for the actual data of what happened on each hand. As ... more >>
Restoring Master Database
Posted by Lontae Jones at 7/14/2006 12:06:01 AM
I want to restore Master database from one server to another. I set the
database in single user mode and restored and the database send it restored
successfully but when trying to access SQL the agent wouldnt start.... more >>
How to do row level locking in SQL Server 2005?
Posted by Connie at 7/14/2006 12:00:00 AM
Hi,
For example, there are 2 users connecting to the same table and want to
update the different rows. They are requested to use the row level locking.
Pls advise and provide the example of sql statement or sample code.
Thank you
... more >>
real-world query - too difficult for me!
Posted by Jim Lawton at 7/14/2006 12:00:00 AM
I have to resolve this problem - I have various ways I can do it, but I
don't know enough SQL to do it in a single query (I have to do that,
because the solution is cross-platform, and has to wrk where stored
procedures aren't an option.
Given these tables :-
Level1Table
L1key L1Code
... more >>
Vertical Partitioning Advice
Posted by Chris at 7/14/2006 12:00:00 AM
I have a large table which has grown to 162 columns.
For better performance, I am considering Vertical partitioning to split this
single table into smaller tables
[Orders : OrderProperties : OrderExtendedProperties ] using views to combine
when needed.
I've done a lot of online research to ... more >>
Running .sql file using C#
Posted by Gislain at 7/14/2006 12:00:00 AM
Hi,
I'm trying to run .sql file with C# code, but i have systematically an error
message with the "GO" instruction. When i test the script in SQL Server
Management Studio, it work fine !!!
First part of the error message
----------------------------------------
{System.Data.SqlClient.S... more >>
Rights Question
Posted by Bart Steur at 7/14/2006 12:00:00 AM
We have setup our SQLServer 2000 as follows:
We added the entire domain group ICT as login. So at the Logins view in
Enterprise Manager is shows DOMAIN\ICT. The group ICT in the domain contains
three (3) users. One of the users is JTB.
Now we have a database called lets say Production. We ... more >>
How to execute a combined SQL character string in stored procedure
Posted by Joseph Lu at 7/14/2006 12:00:00 AM
hi all,
could any one tell me how to execute a combined SQL string in stored
procedure, thanks!
my code as follow:
/*******************************************/
CREATE procedure sp_copy3sectable
@tblname varchar(10)
as
declare @sqlstr varchar(50)
set @sqlstr = 'select * into... more >>
|