all groups > sql server new users > november 2005 > threads for november 22 - 28, 2005
Filter by week: 1 2 3 4 5
change an existing table by code
Posted by Sam at 11/28/2005 12:18:51 PM
how can i mannage by code changes in an existing table propeties -
add/remove a field, chang char length and so on?
... more >>
Code to assign variable in loop
Posted by Lawrence Garvin at 11/28/2005 11:59:05 AM
I'm trying to devise syntax to assign a value to a variable from a field in
the table, where the variable is a different value each time through the
loop. Obviously this would be an array solution in a normal coding
environment. Is there anything I can do in T-Sql to emulate this?
This proc... more >>
Sorting data in a View
Posted by James_101 at 11/27/2005 7:45:05 PM
I have completed an SQL statement that displays data using SELECT. I would
like to put the SQL in a View so my user could open it easily. But, I need
to sort the first two columns alphabetically.
To use Order By in a View, I understand that I need to include a TOP clause.
Can I use TOP 10... more >>
Using CASE with a variable
Posted by James_101 at 11/26/2005 6:09:01 PM
I am trying to set a variable=1 or 0 based on a condition. If the value in a
field (char data type)='01', then I want to have @MyVar=1, else @MyVar=0.
MyVar is currently a tinyint.
I have tried the CASE statement:
DECLARE @MyVar TINYINT
SELECT
@MyVar=
CASE
WHEN FieldValue='01' THE... more >>
Displayed width of field in a view
Posted by James_101 at 11/26/2005 7:46:03 AM
I have a table with a single field (varchar data type). Record #1 has about
125 characters in that field. When I display the table using a SELECT
command, I would like the width of the displayed field to be enough to
display all of the 125 characters on one line.
When I run the SELECT que... more >>
Adding text to a view
Posted by James_101 at 11/25/2005 2:52:01 PM
Is there any way to add instructional text to a view. My user will open a
view and not understand some of the data in the displayed table.
The only workaround I see is to create a new table with one field:
Instructions. In the table I enter instruction 1 as record 1, instruction 2
as rec... more >>
Simplifying an SQL CASE statement
Posted by James_101 at 11/25/2005 7:49:04 AM
In a SELECT command used in SQL Query Analyzer, I have written the following
code. With three functions in sequence (CAST, CAST, Round), the code seems
unnecessarily complex:
CASE
WHEN MyVar1='01' THEN CAST(CAST(Round((MyVar2)/22.0,0) AS int) AS char(5))
ELSE '-'
END AS Core_Tools
MyV... more >>
"If" statement in Query Analyzer
Posted by James_101 at 11/23/2005 12:16:13 PM
I am replicating a SELECT statement from Microsoft Access to SQL Server.
In Access, the SELECT statement used in a query is:
AS SELECT Unit AS Facility, IIf([Mod_Compl_Intro]="1" Or
[Mod_Compl_Intro]="-1","Complete","-") AS Introduction
FROM User_Data_Table
If a record contains 1 or -1 ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Getting Northwidn into SQLServer 2005 Express
Posted by middletree at 11/22/2005 10:48:46 PM
A few days ago, I asked for help getting the Northwinds db into SQL Server
2005 Express. I was pointed to
http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46a0-8da2-eebc53a68034&DisplayLang=en
I downloaded this, but cannot figure out how to get it into SQL Server 2005
... more >>
Trying to restore a database
Posted by isabelle at 11/22/2005 10:37:01 PM
Hi,
A user deleted some data and I'm trying to restore the database up to a
certain point in time. My backups are going to a network drive and I see the
backup and log files that I want to use for my restore. Before I started the
restore, I issued a manual complete backup of the database ... more >>
|