|
Mycroft Holmes wrote: Can a url have unicode characters in it?
You're right, as far as I know it cannot not have unicode characters. Varchar could be a better option.
|
|
|
|
|
You can use nvarchar.
SQL server 2000 also supports user defined datatypes. So you can also make your own url datatype.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
I have to tables in SQL Server 2005....
01) EmployeeMaster (DeptId as FK)
02) DepartmentMaster
Now, I am writing a SQL Query which returns me the All Employee from the EmployeeMaster belogs to the "SQL" department.
I manage to write the query but I want result in different manner:
My original result from the SQL is as under:
Result from SQL
--------------------
DeptId DeptCode DeptName EmpId EmpName
D00001 MS00001 SQL E00001 ABC
D00001 MS00001 SQL E00002 EFG
D00001 MS00001 SQL E00003 XYZ
My requirement is
---------------------
DeptId DeptCode DeptName EmpId EmpName
D00001 MS00001 SQL E00001 ABC
E00002 EFG
E00003 XYZ
in my requirement only one row will be displayed.
How can achieve this result by writting SQL Query?
Thanks,
|
|
|
|
|
Chadamama wrote: Result from SQL
--------------------
DeptId DeptCode DeptName EmpId EmpName
D00001 MS00001 SQL E00001 ABC
D00001 MS00001 SQL E00002 EFG
D00001 MS00001 SQL E00003 XYZ
My requirement is
---------------------
DeptId DeptCode DeptName EmpId EmpName
D00001 MS00001 SQL E00001 ABC
E00002 EFG
E00003 XYZ
in my requirement only one row will be displayed.
You have three rows in the data example. Do you mean that you don't want to show repeating values. If that's the case, as far as I know, you can't do it with SQL. You could write a procedure and manipulate the result in the proc.
|
|
|
|
|
Thank you very much!!!
I will try to do in function or Procedure.
your help is precious..
again thank you.
|
|
|
|
|
|
Hello friends suppose I have a table name commitment. That is two field name IsClosed (samll int), IsRejected (small int).
Now I need to run a query that will print "Open" if both (IsClosed & IsRejected) are 0. And will print "Closed" if IsClosed = 1 & IsRejected = 0.And will print "Cancelled" if IsRejected = 1 for each row.
Any help will be really appreciated.
Thanking Advance
Johnny
|
|
|
|
|
If you're using SQL Server, it could be something like:
SELECT
Status =
CASE (IsClosed = 0 AND IsRejected = 0) THEN 'Open'
CASE (IsClosed = 1 AND IsRejected = 0) THEN 'Closed'
CASE (IsRejected = 1) THEN 'Cancelled'
END
FROM Commitment
|
|
|
|
|
|
|
I hope this will help you.
select *,<br />
case when IsRejected = 0 and IsClosed =0 then 'Open' <br />
when IsRejected = 0 and IsClosed =1 then 'Closed'<br />
when IsRejected = 1 then 'Canceled'<br />
end as [Status]<br />
from myTable
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
|
You are welcome.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
suppose My Query Like
Select x.srlNo,x.ProductID from (Select Srlno,ProductID,SaleType from SaleDetail)as x where X.Srlno in (Select Y.SrlNo-1 from(Select SrlNo from SaleDetail
where SaleType=5) as Y)
"It is Just One Row value I am Specify, Actually it is generate Dynamicaly"
How Can I Modifying my field through Case When.
I want to Modify some field of the Current Row with the Privious row data in my Query
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
pdnet wrote: It is Just One Row value I am Specify, Actually it is generate Dynamicaly"
How Can I Modifying my field through Case When
pdnet wrote: I want to Modify some field of the Current Row with the Privious row data in my Query
If you're using SQL Server, that won't work unless you create a function and store the value from the previous row. Also you may have trouble defining which is the previous row since typically the rows are coming in random order.
Perhaps you should write a little example with data, what you're trying to achieve.
|
|
|
|
|
Suppose My Data Looks Like :
SrlNo Type ProductID Group
1 1 1.0 A
2 1 2.0 B
3 2 3.0 C
4 1 4.0 A
I Want to Update This Data in My Query in this way that "If the Type of the Product is 2 then It is Replaced by the Previous Product's Group"
That means :
SrlNo Type ProductID Group
1 1 1.0 A
2 1 2.0 B
3 2 3.0 B
4 1 4.0 A
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
You can use CASE to modify the result based on the value, like:
SELECT
...
CASE
WHEN (Type = 2) THEN (SELECT Group FROM TableName WHERE ???)
ELSE Group
END,
...
FROM TableName
but the problem is, how you identify the previous product group? There should be somekind of logic for that.
|
|
|
|
|
Hi all,
I have one table in which there is a column named productDetail which has datatype varchar(8000). When i queried to this table, it takes lots of time to search. There is a 6 lac records in my table.
I try to use Fulltext indexing, but it has some limitation for some words which it can not able to search as per my knowledge.
I use SQL Server 2000. Is there any ways to make search more faster.
Thanks in advance...
Krishnraj
|
|
|
|
|
Fulltext indexing would be the correct way if you search for words.
Krishnraj wrote: it has some limitation for some words which it can not able to search as per my knowledge
What kind of limitations? Full text search should be able to search for any exact words. If you want to search for a word in different forms, then it may have limitations.
|
|
|
|
|
Hi mika,
Thank for replying..
Few days ago i read somewhere in site that fulltext indexing can not search all words. that is why i wrote like this.
so to search from fulltext indexed column i have to use Contain or something that kind of word. M i right?
Actually i have no idea how to use it? so give some suggesion how to use it.
Thank you again...
Krishnraj
|
|
|
|
|
Krishnraj wrote: so to search from fulltext indexed column i have to use Contain or something that kind of word. M i right?
Yes, see CONTAINS (Transact-SQL)[^] and FREETEXT (Transact-SQL)[^]
Krishnraj wrote: Actually i have no idea how to use it? so give some suggesion how to use it.
On those documents there are several good sample queries. Have a look at them.
Also remember that Full Text Indexing service must be running in order to use full text search.
|
|
|
|
|
Thank you very much for yr suggesion
and yes i also take care abt indexing service
Krishnraj
|
|
|
|
|
I am using OleDb database and has this error when ExecuteNonQuery().
what can i do to solve it?
Thanks
|
|
|
|
|
Check this link.[^]
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
It would be helpful if you provided a snippet of the actual code so that we could see what you are doing, but my first guess would be that you are executing a query that has a parameter named @Model, but you have not provided a value for that parameter.
|
|
|
|