all groups > sql server programming > january 2006 > threads for tuesday january 10
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
Sample Code in On-Line Help for SQL Server 2005 is Wrong
Posted by TimS at 1/10/2006 11:11:02 PM
Hi, I am using the On-Line Help in SQL Server 2005 and did a search on the
following text: "OR (Transact-SQL)" There is a "Copy Code" icon next to the
example that illustrates the use of the OR operator. I copied the code and
pasted it into a query window to execute it. However, the copy of... more >>
Adventure Works?
Posted by Itzik Ben-Gan at 1/10/2006 11:05:09 PM
I'm curious; what do people here think about AdventureWorks? Do you use it
often when you need to demonstrate something?
--
BG, SQL Server MVP
www.SolidQualityLearning.com
www.insidetsql.com
... more >>
The user is not associated with a trusted SQL Server connection.
Posted by Adam J Knight at 1/10/2006 9:36:14 PM
Hi all,
I am getting this error when trying to connect to SQL Server 2005 express.
The user is not associated with a trusted SQL Server connection.
I am assuming it has to do with the server being configured for windows only
authentication, but can't seems to find where i can rectify this... more >>
SELECT Help
Posted by Vishal at 1/10/2006 8:57:27 PM
Hi,
I have a Sales Table the structure is as follows :
ID INT
StoreID INT
Month INT
Year INT
Sales MONEY
the Data in the table is as follows
ID STOREID MONTH YEAR SALES
1 1000 ... more >>
Openquery Help Requested
Posted by w at 1/10/2006 8:17:54 PM
sql server = server A
sybase = server B (set up as a linked server in A)
I have a stored procedure in A that contains the following statement:
SELECT * FROM OPENQUERY(B, 'exec storedproc')
which runs the procedure in B just fine. It truncates a table in B and
then populates it with data f... more >>
temp table and SP
Posted by shank at 1/10/2006 7:53:41 PM
The below code (except for "CREATE PROCEDURE stp_RES_PopDL AS") works fine
in QA. But when I try to create the SP, I get an error: Table #Comps does
not exist. How do I get around this?
thanks!
CREATE PROCEDURE stp_RES_PopDL AS
-- DROP THE TEMP TABLE IF IT EXISTS
if exists (select * fro... more >>
Any quick way to find middle value out of 3?
Posted by Farmer at 1/10/2006 6:58:55 PM
Please help
declare @t table (id1 int not null, id2 int not null, id3 int null)
insert @t values (1,2,null) -- middle null
insert @t values (10,20,1) -- middle 10
insert @t values (11,23,12) -- middle 12
insert @t values (20,100,123) -- middle 100
select *, middle(ID1,id2,id3) ... more >>
Comparing Two Tables Without a Cursor...HELP!!!
Posted by BenignVanilla at 1/10/2006 6:49:36 PM
I have a project I am working on that has two tables. One is a reference
table, and the other is a table that stores incoming data from an outside
vendor. The customer wants us to write a "solution" that will compare the
incoming data table to the lookup table, and find records that don't matc... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Advice on CASE statement
Posted by Tim Harvey at 1/10/2006 5:59:49 PM
Can someone guide me in the correct direction as to what's going on with
this case statement:
This was derived from and access IIF statement
Access IIF statement:
IIf([meterreading] & ""="" Or [previousreading] & ""="",Null,
(IIf([MeterReading]>=[PreviousReading],[MeterReading]-[previousre... more >>
derived table
Posted by js at 1/10/2006 5:22:24 PM
Hi,
what's the syntax for a derived table?
select count(*) from (select hostname, program_name from sysprocesses where
program_name='mydb' group by hostname, program_name) as DB1?
I want to return how many rows after group by hostname, program_name. How to
do this in a query?
Please he... more >>
Connect to SQL Server 2005 Express Edition using SQLDMO
Posted by Igor Solodovnikov at 1/10/2006 4:52:10 PM
Hi!
I have small testing sqldmo.vbs script to check sqldmo connectivity:
Dim srv
Set srv = CreateObject("SQLDMO.SQLServer")
srv.LoginSecure = True
srv.Connect "(local)" ' Here is error when trying to connect to Express
Edition
MsgBox srv.VersionString
Under Windows 2000 with SQL Serv... more >>
How to Set dynamic column name or Change column name dynamicly
Posted by M at 1/10/2006 4:22:51 PM
How to Change column name dynamically
Declare @Column_name Varchar(30)
Set @Column_name = (Select Name from Customer where ...)
Create table #temp
(
Name Varchar(30)
Date datetime
Sales Money
)
EXEC sp_rename '#temp.Name', @Column_name, 'COLUMN'
It fails
... more >>
check & limit number users
Posted by js at 1/10/2006 4:19:07 PM
Hi,
Can I check and limit number occurrence users connect to sql server? Please
advice.
Thanks.
... more >>
View with spaces in field names?
Posted by Linn Kubler at 1/10/2006 4:07:43 PM
Hi,
I'm trying to query a vew that has spaces in the field names.
For example:
The view is defined with:
select id as "User ID", address as "Home Address", zip as "Zip Code"...
And I'm trying to query this view like this:
Select User ID, Home Address from some_table left outer join myV... more >>
xp_readerrorlog
Posted by Brent at 1/10/2006 4:00:57 PM
Does anyone know the valid parameters for
xp_readerrorlog?
Thanks in advance!
Brent
... more >>
Closing gaps in Celko-tree
Posted by Lasse Edsvik at 1/10/2006 3:58:39 PM
Hello
I've been using that nested modeltree that Celko uses, and it's superb, but
I've encountered a problem with a table (some unforseen things happened when
i tried to move subtrees from A to B), and a really huge tree ended up with
gaps, structure of tree isnt messed up or anything, just ha... more >>
Sum the individual digits in an integer
Posted by Terri at 1/10/2006 3:53:06 PM
I need to SUM the individual digits in an integer. My integer will always be
less than 99
DECLARE @TestInt tinyint
SET @TestInt = 21
How do I return 3.
... more >>
job script
Posted by JFB at 1/10/2006 3:48:34 PM
Hi all,
I'm doing some scripts in a schedule job. Looks like I have some limitations
on the size of the code inside of the steps.
It's a way to fix this?
Tks
JFB
... more >>
SQL Server 2000 Trigger - Get value to be inserted
Posted by ryan.d.rembaum NO[at]SPAM kp.org at 1/10/2006 3:46:35 PM
I have a table that contains a large list of UserIDs. One column in
this table tells whether that user is allowed to have entries in a
second table.
ex:
TABLE USER
USERNAME | AUTH
User 1 | true
User 2 | false
TABLE 2
USERNAME | Some other columns
IF A... more >>
numbering each row
Posted by shank at 1/10/2006 3:42:12 PM
I'm sure this has been asked a bunch of times, but I can't find samples that
apply to many groups and columns. I also found ROW_NUMBER() function for SQL
2005. Unfortunately, I have SQL 2000. I realize this should be done in the
display of data but I have to get it done in a table. I believe R... more >>
can alter table drop multiple columns
Posted by Abraham Andres Luna at 1/10/2006 3:15:21 PM
i tried to run this script:
ALTER TABLE RDKCOCUS
DROP COLUMN [Administration Executive],
DROP COLUMN [Administrator],
DROP COLUMN [Auditor],
DROP COLUMN [Chairman],
DROP COLUMN [Chief Executive Officer],
DROP COLUMN [Chief Financial Officer],
DROP COLUMN [Chief Operating Officer],
... more >>
Split First name and last name if lastname is number
Posted by Disney at 1/10/2006 2:19:03 PM
I need a way to convert names for example like MPX 22 to first name MPX and
lastname =22. Below is the code I am currently using but returns null for
both fields
'User_First_Name' =Case when rtrim(agent) is null or rtrim(agent) ='' then
'NA'
else rtrim(rtrim(Substring(agent,patindex... more >>
Last year comparable Business Day
Posted by Brian Baumann at 1/10/2006 2:11:54 PM
/**
DESCRIPTION
Okay, I have an app that I need to compare information from two dates
in. The two dates are whatever date is passed to it, and its equivalent
business day from last year. For instance, today is January 10th,
2006. January 10th is the tuesday of the second week in 2006. I need t... more >>
Deadlocks
Posted by steve.edison NO[at]SPAM gmail.com at 1/10/2006 2:09:03 PM
We have a deployed website with many concurrent users who are mostly
reading from the database although there are frequent inserts/updates
as well. At scheduled intervals, we run multiple matching queries
against a table with around 120,000 rows. We used to run it WITH
(NOLOCK), but we decided... more >>
Update existing field to unique value
Posted by Terri at 1/10/2006 12:42:53 PM
I have some legacy data (codes) that I need to integrate into a new
application. The new application will only accept 3 characters, my legacy
data is 3 or more characters. My plan is to:
1) run a one-time UPDATE to create new data that is a unique 3-character
code. Given my DDL I want to look ... more >>
Checking if a SQLServer exists using SQL
Posted by Miles Cousens II at 1/10/2006 12:29:14 PM
I am trying to write a query that looks at a linked server. What I want to
do is return an error through SQL to let me know if that SQLServer instance
is in fact running. Currently I keep getting the following message back
Server: Msg 17, Level 16, State 1,Line 1
SQL Server Does not exist or a... more >>
Creating a Picture in CLR?
Posted by Martin Josefsson at 1/10/2006 11:10:02 AM
I should want to be able to dynamic create a picture in SQL 2005. I have
looked at CLR and this look very intresstning but i can not import
System.Drawing into my project. Is it possible to do this in any way? The
dynamic picture will be returned in a SELECT so i need to use UDF.
/Martin... more >>
String parsing
Posted by Griff at 1/10/2006 10:50:13 AM
I have inherited a stored procedure that receives a varchar parameter
@values.
@values is supposed to be a comma separated list of integers, for example
'34, 873, 2347, 9873, 23894732'
This is then used in some dynamic SQL to say 'select * from table where
table.value in (' + @values + '... more >>
recompile time of an SP
Posted by Kalyan Yella at 1/10/2006 10:42:48 AM
How to check when a specific stored procedure was last re-compiled ?
... more >>
How to pass a list of integer values to SP?
Posted by Michael Bray at 1/10/2006 10:19:51 AM
I have a stored procedure that I want to look like this:
SELECT * FROM Table WHERE Key IN (@keyIds)
How can I declare the @keyIds (ints) in the SP so that I can pass multiple
values? I know SQL Reporting Services can do this, but I don't want to use
SRS.
-mdb... more >>
SQL Server 2000 inline comments
Posted by niblick NO[at]SPAM juno.com at 1/10/2006 9:30:47 AM
We are experiencing a problem with a migrated database. Seems that the
end of line character(s) is being treated differently in the stored
procedures from one installation of the database to the new
installation.
The problem we are seeing is explained here:
http://support.microsoft.com/kb/19... more >>
Date query
Posted by fniles at 1/10/2006 9:10:21 AM
I have the following table with datetime and varchar(10) columns.
CREATE TABLE tblA (
fillDated datetime NULL ,
fillDate varchar (10)
)
Sample data:
fillDated fillDate
1/13/2006 1/13/2006
12/19/2005 12/19/2005
I would like to query those records where the date is >= toda... more >>
Indexes and ADO.NET
Posted by TechGladiator at 1/10/2006 8:32:23 AM
I have an app that uses both SQL 2005 and SQL 2000 as the DB. My
question is when I run a query with ADO.NET throught VB.NET without
specifing the "WITH INDEX" in the query, does SQL automatically use any
indexes available?
Also, I tried running the SQL Tunning Wizard w/ SQL2005 and after I g... more >>
RAND
Posted by Phil at 1/10/2006 8:25:05 AM
Hi,
Just looking at the RAND option to be used in SQL, is it at all possible to
also include a random selection of Upper Case letter in the random select
and then to check that this value has not been used before by checking the
value in another table? The end code shoule be 10 character... more >>
Need Help with UDF's Please
Posted by kirk1880 at 1/10/2006 8:16:01 AM
I need a scalar function that I can call from a select statement (with other
criteria) that will dynamically return all the columns (And sometimes their
datatypes with a mode option), from a table or view from any database on that
server. The function needs to work in both SQL 2000 and SQL 20... more >>
On any change or update
Posted by Codesmith at 1/10/2006 7:39:01 AM
I am wiriting a C# application that stores availabilty information in a table
ie UserName, UserAvailable (just to keep it simple)
I am looking for a recommendation for the best way to have the SQL database
notify my c# client that any data in this table has been changed.
In my old non .n... more >>
SQL Express 2005 Supported Languages vs SQL Server Enterprise 2005
Posted by dcew at 1/10/2006 7:27:04 AM
In the SQL Server 2005 Express Edition Overview document on MSDN located here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sseoverview.asp
It states, under the Language Support section:
"The SQL Server Express database engine supports all of the 12 languages
tha... more >>
Cursors
Posted by Phil at 1/10/2006 7:08:03 AM
Hi All,
I am trying to create a cursor that inserts new records from one table into
another where they are not present in the second table
First Table
Name Address Postcode Code
Ben 3 High Street SSL 124L
James 5 Lower Street CH6 ... more >>
calculate a sum
Posted by Xavier at 1/10/2006 6:25:04 AM
hello,
i have a large table with invoices ~ 8 Mio entries,
with a structure ->customNr,ProductNr,SellPrice,InvoiceDate
example
TInvoices
100001 22 23,22 19991129
100001 14 23,22 20051222
100001 22 23,22 20061230 *
100001 15 23,22 20051229
100001 11 23,22 20060101
100... more >>
How can I find altered objects in the database?
Posted by Elena at 1/10/2006 2:02:02 AM
Hi everybody!
Is there a way to find what objects(tables, stored procedures) have changed
in the database since the certain date? Colleague is absent and I need to
extract schema changes he made in the database.... more >>
further to problem with obtaining first/last occurance of contiguous blocks of data
Posted by wiley at 1/10/2006 1:04:52 AM
Hi again, I was hoping someone could help me create a sql query to
minimizing the content in my table based on a few rules.
Further to my previous post...
http://groups.google.com.au/group/microsoft.public.sqlserver.programming/browse_thread/thread/b14260359bc66088/33f57129f2b9da63?lnk=st&q=... more >>
Regarding ETL, urgent
Posted by Enric at 1/10/2006 12:22:02 AM
Dear all,
I've got two DTS with a lot of transformations and within of them VbScript
snippets and so on. My issue is that both has been modified incorrectly but I
haven't idea where and how. So this way I was wondering if exists any
third-tool on the market (I'm not thinking in the own Sql ... more >>
simple TSQL problem
Posted by NJ at 1/10/2006 12:07:55 AM
Hi All,
I have a simple problem with GROUP BY
If I have sample data as follows:
id group id type
date
1 400 I
10/12/05
2 400 I
11/12/05
3 ... more >>
|