Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 help me out for storing more data

Author  Topic 

asifbhura
Posting Yak Master

165 Posts

Posted - 2006-07-16 : 02:12:28
CREATE TABLE [dbo].[blogs] (
[blog_title] [nvarchar] (500) ,
[blog_desc_full] [varchar] (8000) ,
[blogger_name] [nvarchar] (100) ,
[mailid] [nvarchar] (100) ,
[blogid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL ,
[blog_desc] [nvarchar] (125) ,
[cat_name] [varchar] (100) ,
[b_url] [varchar] (250) ,
[b_date] [datetime] NULL ,
[author] [nvarchar] (250) ,
[approval] [char] (1)
) ON [PRIMARY]
GO

using this script i have created my blog table.

and a procedure given below. i am using to insert data in it.


CREATE PROCEDURE SP_BlogAdd

@blog_title nvarchar(500),
@blog_desc_full varchar(8000),
@blogger_name nvarchar(100),
@mailid nvarchar(100),
@blog_desc nvarchar(125),
@cat_name varchar(100),
@b_url varchar(250),
@author nvarchar(250)

AS

INSERT INTO blogs(blog_title, blog_desc_full, blogger_name, mailid, blog_desc, cat_name, b_url,author)
VALUES(@blog_title ,@blog_desc_full ,@blogger_name,@mailid ,@blog_desc ,@cat_name ,@b_url,@author)
GO

now, the problem i m facing is.
i am using varchar datatype for [blog_desc_full] [varchar] (8000).

i want more than this size to store data in it.

please give me some detailed code.

i tried text datatype but i didnt succeed. how to use text datatype.
i replaced with text datatype.but in length i couldnt type. it shows only 16.

Please help me out.

regards,
ASIF

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-07-16 : 04:41:56
I Guess you need to Restructure your steps.

-- First Limiation to the Text Datatype, you can not create the variable
of the Text datatype. so you cannot pass in the stored procedure directly.

According to me the following are some of the Alternative Methods you
can use, but there are lots of gurus in these group who can suggest you
the better ideas..


-- Create your Table with the following Script.
CREATE TABLE [dbo].[blogs] (
[blog_title] [nvarchar] (500) ,
[blog_desc_full] [Text] (8000) ,
[blogger_name] [nvarchar] (100) ,
[mailid] [nvarchar] (100) ,
[blogid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL ,
[blog_desc] [nvarchar] (125) ,
[cat_name] [varchar] (100) ,
[b_url] [varchar] (250) ,
[b_date] [datetime] NULL ,
[author] [nvarchar] (250) ,
[approval] [char] (1)
) ON [PRIMARY]
--- Changes in your SP..
CREATE PROCEDURE SP_BlogAdd

@blog_title nvarchar(500),
@blog_desc_full_1 varchar(8000),
@blog_desc_full_2 varchar(8000) = '',

@blogger_name nvarchar(100),
@mailid nvarchar(100),
@blog_desc nvarchar(125),
@cat_name varchar(100),
@b_url varchar(250),
@author nvarchar(250)

AS

INSERT INTO blogs(blog_title, blog_desc_full, blogger_name, mailid, blog_desc, cat_name, b_url,author)
VALUES(@blog_title ,@blog_desc_full_1+@blog_desc_full_2 ,@blogger_name,@mailid ,@blog_desc ,@cat_name ,@b_url,@author)

While passing from the frontend, pass first 8000 characters in the
@blog_desc_full_1 and remaining in the @blog_desc_full_2, so that it
will be inserted, in the text columns.

-- Now the 2nd method can be..
If you dont want to use the Text Datatype, then you can create the
Secondary Table for saving the blog desc and can while retriving you
can Concanicate based on the Foreign key and can display.


quote:
i replaced with text datatype.but in length i couldnt type. it shows only 16.

16 bytes is the pointer.

Chirag
Go to Top of Page
   

- Advertisement -