|
That's really along the path I want to go. I use lookup tables to associate human readable data with numeric identifiers, then code the actual data using the identifiers to conserve space. I also plan to use a few boolean identifiers to control visual elements by turning on and off the displays for controls that are only used for some items. If something new is required, I only have to add a couple of records to the lookup tables.
Will Rogers never met me.
|
|
|
|
|
Roger Wright wrote: visual elements
Text display from the database. Make sure those have their own column.
|
|
|
|
|
Hi all,
Can anybody help me in the following issue.
I have a course table contains coursename and type
I want to select course name and type and the display should like
Coursename(type)
th problem is my type values are integers..
For example 1 for Regular type ,2 for distance type
so if type is 1 and coursename is MCA
Output should be
MCA(Regular)
is it possiblle thru the sql statement
Thanks in advance,
Reena
|
|
|
|
|
I guess you have to have linked table for type of course,
Here is example how it should be
select
case when [type]=1 then 'MCA' when [type]=2 then 'Another Title' end + ' (' +
coursename +')' as TypeAndCourse
from courses
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Blue_Boy wrote: select
case when [type]=1 then 'MCA' when [type]=2 then 'Another Title' end + ' (' +
coursename +')' as TypeAndCourse
from courses
just little changes
SELECT [Coursename] + '(' + case when [type] = 1 THEN 'Regular' when [type]=2 then 'Another Title' end + ')' as TypeAndCourse
from courses
but i am agree with "Mycroft Holmes" suggestion of creating new table..
Where can we go to find God if we cannot see Him in our own hearts and in every living being
-Swami Vivekananda
|
|
|
|
|
Create a table of CourseTypes with a PK field and a description.
This is then an extensible solution if you need to add another type.
Create a view with an inner join (assumes the type is required in the course table and that a course can only have 1 type) to the type table and include the course type description field (I name the view vwCourse)
Or just do it the way the Blue one suggested!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Try this
Declare @Course table ([Course Name] Varchar(100),[Course Type] Int)
Insert Into @Course
Select 'MCA',1 Union All
Select 'MCA',2
;With CTE AS(
Select [Course Type] = 1,[Course Description] = 'Regular' Union All
Select [Course Type] = 2,[Course Description] = 'Distance'
)
Select
Result =
c.[Course Name]
+ '('
+ CTE.[Course Description]
+ ')'
From @Course c
Join CTE ON c.[Course Type] = CTE.[Course Type]
If you are using Denali CTP 3, you can use the new Choose function
Select
Result =
Concat(
c.[Course Name]
,'('
,CTE.[Course Description]
,')'
)
From @Course c
Join CTE ON c.[Course Type] = CTE.[Course Type]
Output
Result
MCA(Regular)
MCA(Distance)
Niladri Biswas
|
|
|
|
|
Hi,
i am new to DB2, i have certain db2 commands like "Create Database", "connect to database".
These commands i am executing in db2 script file say ex: "script.db2" file.
what is the command to quit the command line processor window.
When i open the Command line processor window, and i enterered the "exit" commmand manually it works fine.
But the same i given in my script.db2 file, its not working... what could be the problem..
Please help me to resolve this.
Thanks,
Mani
|
|
|
|
|
|
Hi,
How to write isnull(exp1,exp2) in the where condition of linq.
eg;
SQL:
... where userpk = isnull(@userpk,userpk)
i need to convert the above query to linq
Thankyou,
Yesuprakash
|
|
|
|
|
|
This may help
where
!string.IsNullOrEmpty(record.Field<string>("userpk"))
? record.Field<string>("userpk")
: null
Niladri Biswas
|
|
|
|
|
Hi,
I am BE final year student. I am doing project using data warehouse. It is review analysis of automobiles. Can anybody give me feedback of this, how is the project at final year level?
Also if i get some links regarding review analysis i will e grateful.
Thank you.
|
|
|
|
|
I have an x64 Server Running SQL Server 08 and within that server I am setting up a linked server to an XP box running SQL express 05. I am setting up the linked server with a server name of "ComputerName\SQLEXPRESS", using the Microsoft OLE DB Provider for SQL Server. It connects fine and passes a connection test, but when i write a simple select query to get all records from the linked server table it returns no records when there are multiple records in the table I have queried. Any one ever seen this before? It should be noted that when I try to add the linked server and keep the radio button selected for sql server it will not connect giving me an error message
VIA Provider: The specified module could not be found.
OLE DB provider: SQLNCLI10 for linked server returned message login timeout expired.
OLE DB Provider for linked server returned message a network related or instance specific error has occured while establishing.....
I am at a loss?
|
|
|
|
|
Member 8003276 wrote: a network related or instance specific error has occured
That's a general message, and there can be many reasons why it can't connect. Try using an IP-address to identify the computer.
Is Sql configured to use TCP/IP or use named pipes?
Did you install all the service-packs?
Bastard Programmer from Hell
|
|
|
|
|
HI
error under
error 1045 - access denied for user 'root' '@localhost'(using password : no)
php my admin tried to connect to the MYSQL server and the server rejected the connection .you should the check the host, user name and password in your configuration and make sure that they correspond to the information given by the administrator of the MYSQL server.
|
|
|
|
|
|
a2bj wrote: you should the check the host, user name and password in your configuration and make sure that they correspond to the information given by the administrator of the MYSQL server
Such a good error message! It perfectly tells you what to do.
I cannot believe that some internet provider would allow you to connect to a MySQL database on the server as root, and without a password...
|
|
|
|
|
You can rest easy. It's on localhost , not an ISP. OP just can't remember what he told mysql so he can enter it into phpmyadmin.
:groan:
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Edit config.inc.php this can be found in phpMyAdmin/libraries
change :
$cfg['PmaAbsoluteUri'] = '';
to
$cfg['PmaAbsoluteUri'] = 'localhost/phpmyadmin/';
change
$cfg['Servers'][$i]['host'] = 'localhost';
to
$cfg['Servers'][$i]['host'] = 'Localhost';
and enter you're password in :
$cfg['Servers'][$i]['password'] = '';
eg
$cfg['Servers'][$i]['password'] = 'password';
reboot MySQL
|
|
|
|
|
Hi,
I am using the following code in sql server to get list of mobile numbers and add the country code to it.
select ('973' + contact_moblle) AS mobile_number from persons where contact_moblle is not null and contact_moblle != '' and len(contact_moblle) = 8 and left(contact_moblle, 1) = '3' order by file_no
I want to do the same but with selecting unque records only.. something like this (but throwing error!)
select DISTINCT ('973' + contact_moblle) AS mobile_number from persons where contact_moblle is not null and contact_moblle != '' and len(contact_moblle) = 8 and left(contact_moblle, 1) = '3' order by file_no
|
|
|
|
|
How about a subselect if your database system allows it?
SELECT ('973' + contact_moblle) AS mobile_number FROM (SELECT DISTINCT contact_moblle FROM persons WHERE ... ) T
Also...
"where contact_moblle is not null and contact_moblle != '' and len(contact_moblle) = 8"
can be reduced to:
"where len(contact_moblle) = 8"
|
|
|
|
|
jrahma wrote: something like this (but throwing error!)
You didn't post an error. I doubt that it'll update the correct field if the dataset is created using distinct values.
Bastard Programmer from Hell
|
|
|
|
|
select ('973' + contact_moblle) AS mobile_number from persons where contact_moblle is not null and contact_moblle != '' and len(contact_moblle) = 8 and left(contact_moblle, 1) = '3' GROUP BY contact_moblle order by file_no
Hope this will help. Check this and let me know the outcome
-Shenbaga Murugan Paramasivapandian
I hate computers and I just mess them up with my code!
|
|
|
|
|
Try this
;With CTE AS
(
Select
Rn = Row_Number() Over(Partition By ('973' + contact_moblle) Order By file_no)
,('973' + contact_moblle) AS mobile_number
from persons
where contact_moblle is not null
and contact_moblle != ''
and len(contact_moblle) = 8
and left(contact_moblle, 1) = '3'
)
Select mobile_number
From CTE
Where Rn = 1
Hope this helps
Niladri Biswas
|
|
|
|