all groups > sql server programming > may 2007 > threads for monday may 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
SELECT Statement
Posted by magix at 5/14/2007 11:28:33 PM
let say if I have following table
itemA itemB target date
2 3 4 5/20/2007
2 3 5 5/22/2007
3 2 2 4/20/2007
3 4 5 3/20/2007
1 2 ... more >>
Dynamically changing database context ('USE [@dbnname]') from query analyzer
Posted by mplpost NO[at]SPAM yahoo.com at 5/14/2007 11:27:47 PM
>From SQL Server 2005 SSMS query analyzer we would like to change the
database context(USE [@dbname](tried dynamic sql, both exec() and
sp_executesql, but this doesnt work) .
We would like to run the alter scripts(service pack) for tables and
stored procedures in some specific databases. Our re... more >>
How to delete a block of rows?
Posted by amerenterprises NO[at]SPAM gmail.com at 5/14/2007 7:31:45 PM
I need to delete the a block of rows in a table.
Tried lots of variations. End up deleting all rows.
eg this query will delete all 5 rows in a test table instead of just
rows 3 and 4:
set ansi_nulls off
go
declare @rows int
set @rows = 0
begin
table_loop:
set @rows = @rows + 1
dele... more >>
How to copy objects with SSIS
Posted by Robert Dufour at 5/14/2007 5:46:04 PM
In sql 200 it was easy, you had a wizard to copy abjects and data.
I can't find equivalent in 2005, using SSIS (export data) I manage to export
the data but the containts, trigers, keys info does not get transferred to
the new database. How do you create an exact copy of the database including ... more >>
Date Query Problem
Posted by JN at 5/14/2007 5:37:59 PM
Hi All,
On my calendar control, the user is able to select it by the week. When this
selection is made, I need the select query to return all the rows in the
database that match the days in the week selection.
for example: the week selection returns a collection of Datetime objects
that ... more >>
Invalid column name
Posted by Laurence at 5/14/2007 5:09:42 PM
In SQL SERVER 2000
I have the following stored procedure.
It gives an error: Invalid Column Name
I am pretty sure that I am getting the error because I am using a column name
in the On Statment.
LEFT OUTER JOIN GRADE ON TheGrade = GRADE.GradeCode
The Column name "TheGrade" was assi... more >>
Problem with comparing casted fields
Posted by news.microsoft.com at 5/14/2007 5:09:22 PM
Why won't the following work?
select * from duessa where not cast(empno as double precision) in =
(select cast(employeenumber as double precision) from member where =
employerno =3D 14)
I also tried it as
select * from duessa where cast(empno as double precision) not in =
(select cast(em... more >>
Programmatically find out the INCLUDE columns on an index
Posted by Mark Howell at 5/14/2007 4:17:47 PM
How can I determine using T/SQL the INCLUDE columns on an Index in SQL
Server 2005?
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Update Query
Posted by zwieback89 via SQLMonster.com at 5/14/2007 3:31:34 PM
Hi,
I have a table - BuildOrganization with firstname, lastname, supervisor,
ManagerFirstName, ManagerLastName.
There are 1565 rows.
For instance,
Create table BuildOrganization
(
LawsonID varchar(50),
FirstName varchar(100),
LastName varchar(100),
Supervisor(100),
ManagerFirstNam... more >>
openrowset and opendatasource issue
Posted by Lynn at 5/14/2007 3:08:15 PM
Hi,
I experienced a strange issue. The Ad Hoc Remote Query is enabled in a
server A. But, when I run openrowset and opendatasource in my client tool
with the following statement (SQL Server managment studio) after connect to
server A, I always get the error message -- "Msg 18456, Level 14... more >>
Query Guru's Please
Posted by John Wright at 5/14/2007 3:02:30 PM
I have the following query
SELECT Station.Station_Name, Traveler_Step.Step,
Traveler_Step.Step_Description, MIN(Step_Result.Result_Date) AS Expr1,
MAX(Step_Result.Result_Date) AS Expr2,
DATEDIFF(hour, MIN(Step_Result.Result_Date), MAX(Step_Result.Result_Date))
AS Expr3
FROM Traveler_S... more >>
Error: String or binary data would be truncated.
Posted by Curious at 5/14/2007 2:24:43 PM
Hi,
When I run the sql script below, I always get error:
Server: Msg 8152, Level 16, State 9, Line 1
String or binary data would be truncated.
The statement has been terminated.
<<< Document Repository - Add EIF Documents.SQL failed. No Records
added. >>>
It seems that something is wro... more >>
Urgent! Create Login Windows Authentication
Posted by Sandy at 5/14/2007 2:22:01 PM
Help! I need to get this app rolled out by Wednesday morning!!
I have an application written in VB6 that is hooked up to Sql Server 2005.
I can't seem to get a regular user to be able to access it. There's a Sql
Server error:
"Login failed for user ''. The user is not associated with a... more >>
Appending values in multiple columns
Posted by Adi at 5/14/2007 2:06:23 PM
hi.
my query needs to return a set of columns into a single column. how
can i do this thing..
Aditya
... more >>
What is wrong with this stored procedure?
Posted by labsRcool NO[at]SPAM community.nospan at 5/14/2007 1:34:01 PM
The following code works great in a standard sql query statement, but does
not work in a stored procedure, why?
Here is my code that works:
-------------------
ALTER TABLE EmployeeInfo
ADD FullTimePartTime char(1)
UPDATE EmployeeInfo
SET FullTimePartTime =
(CASE RateType
WHEN 'SALA... more >>
"LIMIT" or "FETCH FIRST n ROWS ONLY" equivalent in T-SQL?
Posted by dan at 5/14/2007 12:59:55 PM
What is the most effecient way to limit number of rows returned? I only
need a single row - don't really care which one.
Thanks.
... more >>
Advanced Query Help
Posted by R C at 5/14/2007 12:51:01 PM
Hi,
i have a table with the following:
ID
QueryString
Item
DT
Pr
L
the QUerystring field is filled with many rows (eg.
item=psptax100e&l=Streetprices&pr=1249.00&dt=050907&sku=PTAX100U
)
i need to create an update statement to fill in the other fields in the table.
how can i do this.
pl... more >>
Execute SQL Statement
Posted by Agho at 5/14/2007 11:35:03 AM
If I have a stored procedure that returns an SQL statement, how do I execute
the statement returned by the stored procedure? I want to execute an SQL
statement returned by an exec(@sql). How do I accomplish this?... more >>
Referencing a table that is not available in a Stored Procedure
Posted by ERICnLV at 5/14/2007 11:19:02 AM
I am attempting to program a stored procedure that will reference one of two
tables based on a flag. The problem is that the server that one of the tables
is on is only active when in use. Is there a way to reference the table so
that the stored procedure will work even when the table does not... more >>
Out of stack space error
Posted by tashy at 5/14/2007 10:22:00 AM
was editing my website and added a feature in error. I tried deleting it all
to no avail. Then I began getting the following error message:
Microsoft VBScript runtime error '800a001c'
Out of stack space: 'Val'
/admin/content/pages.asp, line 7
The part in /admin/content/pages.asp, ... more >>
comma seperated id's
Posted by Hurricane at 5/14/2007 10:07:26 AM
I have the policyids as a varchar(Max) input to a stored procedure.
trying to get each policy record whose id is in the string
@policiesID = 2,4
sample table
PolicyID text
1 Alpha
2 Beta
3 ... more >>
SQL and use of apostrophes?
Posted by JP at 5/14/2007 9:54:04 AM
I have designed my application to convert (‘) into ' before sending any query
to the database and/or saving a record. I’ve also done other things to filter
out SQL commands and other special characters.
We are having a debate in my office on weather or not its safe to be storing
apostro... more >>
MSDE and a SQL Server 2005 Standard Edition
Posted by Sammy at 5/14/2007 9:28:10 AM
Hi
I have an instance of MSDE installed and I need to install SQL Server 2005
Standard Edition in a side by side configuration. Would this cause any
problem or has any one had any problems with a side by side installtion like
this.
thanks for any advice
Sammy... more >>
database name
Posted by Terry Holland at 5/14/2007 8:12:00 AM
How can I tell the name of the current database from within a stored
procedure? ... more >>
Create Oracle 9i Linked Server
Posted by bkgroups NO[at]SPAM yahoo.com at 5/14/2007 6:27:34 AM
Greetings all,
I'm unsuccessfully trying to create a linked server from SQL Server
2005 to Oracle 9i using OraOLEDB.Oracle. Here's the lovely error
message that I get:
OLE DB provider "OraOLEDB.Oracle" for linked server "test" returned
message "ORA-12504: TNS:listener was not given the SER... more >>
Date
Posted by Sundara Murthy at 5/14/2007 5:39:00 AM
hi experts,
I have table and same is given below.
Sl_No Mc_num complaint_date completion_date
1 1 01-May-07 08-May-07
2 2 05-May-07 Null
3 3 07-May-07 07-May-07
4 1 10-May-07 11-May-07
5 ... more >>
Property CurrentRunStatus cannot be used for filter
Posted by martin at 5/14/2007 3:52:00 AM
Hi! I'm using the objects under the Microsoft.SqlServer.Management.Smo.Agent
namespace and are experiencing problems with the JobServer.EnumJobs method
and JobFilter class. The example below throws an
InvalidPropertyUsageEnumeratorException with message "Property
CurrentRunStatus cannot be u... more >>
Find & Delete duplicate blobs
Posted by Ronald Green at 5/14/2007 1:09:35 AM
Hi all,
I need to find rows with duplicate blobs (text column) in a table.
CHECKSUM, BINARY_CHECKSUM and HashBytes don't operate on text and
image columns.
Should I cast the column to varchar(max)? Any other, better idea?
Thanks for your time,
R. Green
... more >>
Combine a SQL result set
Posted by Jason Huang at 5/14/2007 12:00:00 AM
Hi,
Here is my SQL Table TableA:
ID Item
1 AAA
2 ABB
3 ACC
4 BDD
..
..
The SQL query is "SELECT Item FROM TableA WHERE Item LIKE 'A%'",
and it returns the resultset of
AAA
ABB
ACC
Is it possilbe to do a query so the result is 'AAA ABB ACC' ?
Thanks for h... more >>
URGENT! How to flatten table in SqlServer2000?
Posted by zlf at 5/14/2007 12:00:00 AM
Hi,
Now I have table, it has the following data:
ObjectID Name Value
1 Status Pending
1 User microsoft
2 Status Closed
3 Status Idle
3 Enabled False
I want to convert it into a table like:
ObjectID Status User Enabled
1 Pendin... more >>
Finding all the indexes on a server with AllowPageLocks set to FALSE?
Posted by Daniel Crichton at 5/14/2007 12:00:00 AM
Hi,
While trying to figure out why a Reorganise Indexes task on SQL Server 2005
kept failing, I've discovered that any indexes created via SMSS have
AllowPageLocks set to false (due to SMSS leaving "Use page locks when
accessing the index" unticked by default when creating an index). This
... more >>
Please help beginners
Posted by Peterpeter via SQLMonster.com at 5/14/2007 12:00:00 AM
Table1.F1; F2;F3;..
Table2.F1; ..
Table2.F1;..
Table2.F1;..
Table2.F1;..
How to count F1 in Table1 and count F1 in Table2
F1 is a key column, and I cant use Distinct Count, just Count()
I used Inner Join, but the result was not correct.
F1 in Table1=F1 in Table2, but it cant be,
... more >>
Locking hints
Posted by obelix via SQLMonster.com at 5/14/2007 12:00:00 AM
I want to ensure that a select statement within a stored proc doesnt lock the
selected rows: Is this possibly, If it is whats the correct syntax. (Its the
only statement in the proc)
... thanks
--
obelix
"Whether you think you can or you think you cant you are right" .... Anon
Mess... more >>
Insert into declared table
Posted by Nick at 5/14/2007 12:00:00 AM
When insert data to a declared table in Stored Procedure or User Defined
Function, it run very slow.
eg. The Students table has more than 100,000 records.
Declare @Students Table (StudCode Char(10),Date DateTime,Marks
Numeric(18,4))
Insert @Students
Select StudCode,Date,Marks From Students... more >>
|