Showing posts with label return. Show all posts
Showing posts with label return. Show all posts

Wednesday, March 28, 2012

How to make more than One Page Report in Sql Server Reporting Services 2005

i have a stored procedure that return a single row and more than 100 colums data. i want to show that columns more than one page.

how can i design my report when i preview the report it shows the data on 2 page

DO you want to display the pages next to each other or do you want to display the second page under the first page ? For the first one simply extend the page size to the double size. For the second choice place multiple detail rows on the page until all data is displayed.

HTH, Jens SUessmeyer.

http://www.sqlserver2005.de

Friday, March 23, 2012

How to make a random order query ?

If we use: select * from .... , normally, it will return an ordered result ( may be order by ID ), but how can we make an random order select statement. It mean every time we run the query, the result will be different from the other ?Hi,

FYI:http://www.datawebcontrols.com/faqs/Data/ReturningDataInRandomOrder.shtml

Regards,

Monday, March 12, 2012

How to list row according to the relevance of the keywords searched for99999

Hi

Does anyone know "How to sort values return from an SQL query according to the relevance of the keywords" like the google does.

Thank you..

1. You can store the result in temp table/table variable then apply sorting.

2. You can use the derived quires

3. You can do it on the UI itself (if you use ASP.NET grid controls supports that)

|||

If you use full-text search in SQL Server you could use CONTAINSTABLE and FREETEXTTABLE functions instead of CONTAINS and FREETEXT predicates.

These functions are table-value function and one of returned columns is RANK.

This is example from BOL:

Code Snippet

SELECT FT_TBL.Description,
FT_TBL.CategoryName,
KEY_TBL.RANK
FROM Categories AS FT_TBL INNER JOIN
CONTAINSTABLE (Categories, Description,
'("sweet and savory" NEAR sauces) OR
("sweet and savory" NEAR candies)'
) AS KEY_TBL
ON FT_TBL.CategoryID = KEY_TBL.[KEY]
WHERE KEY_TBL.RANK > 2
AND FT_TBL.CategoryName <> 'Seafood'
ORDER BY KEY_TBL.RANK DESC;
GO

|||can free text search be applied to a column with datatype 'varchar'?|||

It can be applied, but first you must create full-text catalog and full-text index.

See following sample from BOL:

Code Snippet

USE AdventureWorks;GOCREATE UNIQUE INDEX ui_ukJobCand ON HumanResources.JobCandidate(JobCandidateID);CREATE FULLTEXT CATALOG ft AS DEFAULT;CREATE FULLTEXT INDEX ON HumanResources.JobCandidate(Resume) KEY INDEX ui_ukJobCand;GO

Now you could use FREETEXT for Resume column of HumanResources.JobCandidate table

How to list row according to the relevance of the keywords searched for

Hi

Does anyone know "How to sort values return from an SQL query according to the relevance of the keywords" like the google does.

Thank you..

1. You can store the result in temp table/table variable then apply sorting.

2. You can use the derived quires

3. You can do it on the UI itself (if you use ASP.NET grid controls supports that)

|||

If you use full-text search in SQL Server you could use CONTAINSTABLE and FREETEXTTABLE functions instead of CONTAINS and FREETEXT predicates.

These functions are table-value function and one of returned columns is RANK.

This is example from BOL:

Code Snippet

SELECT FT_TBL.Description,
FT_TBL.CategoryName,
KEY_TBL.RANK
FROM Categories AS FT_TBL INNER JOIN
CONTAINSTABLE (Categories, Description,
'("sweet and savory" NEAR sauces) OR
("sweet and savory" NEAR candies)'
) AS KEY_TBL
ON FT_TBL.CategoryID = KEY_TBL.[KEY]
WHERE KEY_TBL.RANK > 2
AND FT_TBL.CategoryName <> 'Seafood'
ORDER BY KEY_TBL.RANK DESC;
GO

|||can free text search be applied to a column with datatype 'varchar'?|||

It can be applied, but first you must create full-text catalog and full-text index.

See following sample from BOL:

Code Snippet

USE AdventureWorks;GOCREATE UNIQUE INDEX ui_ukJobCand ON HumanResources.JobCandidate(JobCandidateID);CREATE FULLTEXT CATALOG ft AS DEFAULT;CREATE FULLTEXT INDEX ON HumanResources.JobCandidate(Resume) KEY INDEX ui_ukJobCand;GO

Now you could use FREETEXT for Resume column of HumanResources.JobCandidate table

Wednesday, March 7, 2012

How to known that Sqlconnection is working

Hello all,
Actually i want to known, is their any method or property in SqlConnection class which will return some value, so that through which we become confirm that connection has established.

Thanks in advance!Look at the State property of the connection object|||very thanks to you , i think this is what i am looking for.

Sunday, February 19, 2012

How to know a Job Status from Stored Procedure

To execute a job from VB, I use stored procedure with T-SQL :

EXEC sp_start_job @.job_name = 'DTSName'

>From BOL, I know that procedure return 0 (success) or 1 (failure), but
that's only to tell user that job successfully started, right?
What I need is how to know is that job have already executed
successfully or
failed, so if success i will execute another code.

Please help me, thanksyou might want your DTS package to tell you when it fails or not and
based on that execute your next step of code. just a thought.

How to know a Job Status from Stored Procedure

To execute a job from VB, I use stored procedure with T-SQL :

EXEC sp_start_job @.job_name = 'DTSName'

>From BOL, I know that procedure return 0 (success) or 1 (failure), but
that's only to tell user that job successfully started, right?
What I need is how to know is that job have executed successfully or
failed, so if success i will execute another code.

Please help me, thanksSee sp_help_job in Books Online. Alternatively, you could use SQL-DMO
from VB to get the CurrentRunStatus and/or LastRunOutcome property of
the Job object. Another option would be to add more steps to the job
itself, so that if the first step fails, it runs your extra code.

Simon|||But when I have execute sp_help_job if i don't know the job was
finished or not?|||The current_execution_status column tells you if the job is running;
the last_run_outcome columns tells you what happened the last time the
job finished.

If you want something to happen only when the job succeeds (or fails),
then it might be easiest to add another job step, as I mentioned. Then
you don't have to keep checking the job status from the client.

Simon