Wrox Programmer Forums
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 8th, 2007, 11:50 PM
Registered User
 
Join Date: May 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL

i want to show 35 words out of 100 or more words .how can i do it? pls help me.

 
Old May 9th, 2007, 01:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Can you elaborate to us what is that you are trying to accomplish so that we can be of better help to you? "Just one line post" doesn't explain what you are trying to do.

Cheers.

_________________________
- Vijay G
Strive for Perfection
 
Old May 9th, 2007, 01:24 AM
Registered User
 
Join Date: May 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

using SQL SERVER 2005 i want to show 35 words(not character) out of 100 or more words .how can i do it in SQL?.i used substring but it works on character and doesn't show full words (in last,show half words) and its impossible to count character of a senrtence which contains uncountable words .how can i do that?
 
Old May 9th, 2007, 02:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Is that you want the first 35 words to be shown? If so you need to parse through the string and look for white space, count the white space that many times you want the number of words show, and print the content until that.

Hope that explains.
Cheers

_________________________
- Vijay G
Strive for Perfection
 
Old May 11th, 2007, 11:30 AM
Authorized User
 
Join Date: Oct 2005
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you are going to show the first 35 words to the user using an application, the easiest way is for you to do this from that application. If you really need to do it in SQL, what you can do first is to convert that string into a table. Here's a link which you can use, but this assumes that the separator is a comma. Simply modify it to use space instead:

http://www.sql-server-helper.com/fun...-to-table.aspx

Then once you have it in a table, put them back together but using only the first 35 words. Here's another link that may help you achieve that:

http://www.sql-server-helper.com/tip...ed-output.aspx

SQL Server Helper
How well do you know SQL? Find out with the free test assessment from SQL Server Helper!!!
http://www.sql-server-helper.com/free-test/default.aspx

Got a SQL Server Question? Ask us here: http://www.sql-server-helper.com/forums/default.asp





Similar Threads
Thread Thread Starter Forum Replies Last Post
How Run .sql Script file in MS SQL Server 2000? aarkaycee SQL Server 2000 5 October 12th, 2009 05:43 AM
creating ssis packagte for sql server to sql serer Laxmikant_it ASP.NET 3.5 Professionals 0 November 26th, 2008 12:23 AM
Converting from MS SQL 2005 to Sql Epress edition saif44 SQL Language 0 February 16th, 2007 04:17 PM
Failed to copy objects from SQL server to SQL Serv monfu SQL Server 2000 4 December 4th, 2005 05:54 PM
Move SQL DB from one sql to another sql server Israr SQL Server 2000 3 January 24th, 2005 02:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.