473,804 Members | 3,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

nvarchar(max) sql data type equivalen in c#

skg
i am writing a UDF which takes nvarchar(max) as input parameter. Can any one
tell me what is the equivalent of this data type in C#.
Thx
Feb 2 '06 #1
2 13070
There isn't one. You can have a 'string', but you wouldn't be able to
specify a maximum length to it, and you wouldn't need to specify that it can
hold unicode data.

"skg" <sk*@yahoo.co m> wrote in message
news:Or******** ******@tk2msftn gp13.phx.gbl...
i am writing a UDF which takes nvarchar(max) as input parameter. Can any
one
tell me what is the equivalent of this data type in C#.
Thx

Feb 2 '06 #2
skg
Thanks Marina !!! I posted this in public.SQLServe r.programming newsgroup
today, sorry, don't know how to copy the link to that thread for you.
But here is what i am seeing when i do return Length of the input string i
get 4000 always. i am concerned i am loosing bytes when calling the UDF.
Using SQLChar i get correct size. Here is my code snippet. i am i doing
something wrong.
using System;
using System.Data;
using System.Data.Sql Client;
using System.Data.Sql Types;
using Microsoft.SqlSe rver.Server;
using System.Collecti ons;
using System.Security .Cryptography;
using System.Text;

public partial class UserDefinedFunc tions
{

[SqlFunction(IsD eterministic = true, IsPrecise = true, DataAccess =
DataAccessKind. None)]
public static SqlInt32 GetLength(strin g sInputString)
{
return (SqlInt32)sInpu tString.Length;
}
};
select top 10
id,datalength(b lobfield)[SQLSize],dbo.GetLength( blobfield)[UDFSize] from
Table1 where datalength(blob field) > 8000
id SQLSize UDFSize
----------- -------------------- -----------
2 49874 4000
13 28860 4000
62868 8166 4000
62873 9702 4000
62874 36546 4000

"Marina Levit [MVP]" <so*****@nospam .com> wrote in message
news:ex******** ********@TK2MSF TNGP09.phx.gbl. ..
There isn't one. You can have a 'string', but you wouldn't be able to
specify a maximum length to it, and you wouldn't need to specify that it
can hold unicode data.

"skg" <sk*@yahoo.co m> wrote in message
news:Or******** ******@tk2msftn gp13.phx.gbl...
i am writing a UDF which takes nvarchar(max) as input parameter. Can any
one
tell me what is the equivalent of this data type in C#.
Thx


Feb 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2071
by: gordy | last post by:
edit: this came out longer than I thought, any comments about anything here is greatly appreciated. thank you for reading My system stores millions of records, each with fields like firstname, lastname, email address, city, state, zip, along with any number of user defined fields. The application allows users to define message templates with variables. They can then select a template, and for each variable in the template, type in a...
6
7961
by: New MSSQL DBA | last post by:
Hi all, we are now planning to upgrade our application from a non-unicode version to a unicode version. The application's backend is a SQL Server 2000 SP3. The concern is, existing business data are stored using collation "Chinese_PRC_CI_AS", i.e. Simplified Chinese. So I thought we need to extract these data out to the new SQL Server which is using Unicode (I assume it means converting them to nchar, nvarchar type of fields for I...
4
13009
by: D. | last post by:
Hi, I'm starting a new application in java using JTDS jdbc driver (http://jtds.sourceforge.net) and SQLServer 2005 Express. I have to design the database from scratch and my doubt is if I have to use varchar or nvarchar fields to store string data. Any experience about performance issues using nvarchar instead of varchar (considering that Java internally works in unicode too)? Thanks in advance, Davide.
3
9176
by: maurox | last post by:
Hi, i have a simple table with a field called "authors". this filed have a nvarchar(max) type (in MSSql 2005). i have a simple query "Select authors FROM table". in query analizer this return the value of authors, but when i run this in asp page, the field is empty. in the code i have:
5
18344
by: haidani | last post by:
Hi, I am new to MS SQL. When I create a column in a table, when shall I use nvarchar or varchar? Please help. Thanks, Mike
2
4421
by: verb13 | last post by:
I am running this query to an sql server 2000 database from my asp code: "select * from MyTable where MySqlServerRemoveStressFunction(MyNtextColumn) = '" & MyAdoRemoveStressFunction(MyString) & "'" The problem is that the replace function doesn't work with the ntext datatype (so as to replace the stresses with an empty string). I had to implement the MySqlServerRemoveStressFunction, i.e. a function that takes a column name as a...
6
1960
by: =?Utf-8?B?R3JlZw==?= | last post by:
I've come across a few statements that conflict eachother and I'm wondering what is correct. I cam across a web-site (I do not remember the site right now), that explained each data type. For the NVarChar data type it suggested that you never store a NULL value. It said, if you have a NULL value, you should insert some common text instead, such as "N/A or TBD", etc. It said, stored the text "N/A" would take up a lot less space than a...
1
1401
by: DR | last post by:
When a clr has the input type of SqlString it causes nvarchar(4000) to be the parameter type of the function in sql server. how to modify my CLR function to use nvarchar(max) ?
3
6884
by: amollokhande1 | last post by:
Hi All, I am using Sql server 2005 as a backend for my application. I want to read/write the unicode data using sql query. When I am using insert into UnicodeData values('سي') command and if we view the data using sql query analyser, it shows ??. On the otherhand, when i insert the same unicode data through sql enterprize manager simply copying the data in the actual field, it properly stores the data.
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.