What Is Purpose Of N In SQL Examples?

Jul 23, 2005

What is the purpose of the "N" preceding the parameter values in the
SQL examples?

Here is an example copied from Books Online, SP_ATTACH_DB:

EXEC sp_attach_db @dbname = N'pubs',
@filename1 = N'c:Program FilesMicrosoft SQL
ServerMSSQLDatapubs.mdf',
@filename2 = N'c:Program FilesMicrosoft SQL
ServerMSSQLDatapubs_log.ldf'

I've found that my sp_attach_db routine works without the "N", but I
need to know what it is that I don't know.

Thank you everybody for all your help.

View 1 Replies


ADVERTISEMENT

XML And DTS Examples

Feb 18, 2002

Are there any examples of using DTS and XML/XLS? specifically, importing data. I have searched through BOL and cant find any, nor is there any reference to XML in the book "Professional SQL 2000 DTS"

Many thanks

View 2 Replies View Related

Examples

Jul 20, 2005

I see a lot of example, but where do these example procedures go. Likedeclare (whatever)?below is an example i read. Where do you put this to make it execute, is itthe view screen or the stored procedure screen?I'm using MSDE now to learn, and I can't get nothing working except simpleselect query statements.In the northwind example (northwindcs), how would I do a parameter querylike this:Have a dialog box ask user to enter customerid to bring up. (in a query nownot a form)Also, how would you check if a certain customerid exist? Example, CHOPS isone customerid. If I wanted to use a query to check if it exist, and returnno records, but just do an action (like add a record) if it didn't exist,how?[color=blue]> CPU SQL> (ms)> -- Convert to varchar (implicitly) and compare right two digits> -- (original version -- no I didn't write it)> 4546 select sum(case right(srp,2)> when '99' then 1 when '49' then 1 else 0 end)> from sf>> -- Use LIKE for a single comparison instead of two, much faster> -- Note that the big speedup indicates that> -- CASE expr WHEN y then a WHEN z then b .> -- recalculates expr for each WHEN clause> 2023 select sum(case when srp like '%[49]9' then 1 else 0 end)> from sf[/color]I tried some variations of this, and indeed it seems that there is a costwhen the expression appears with several WITH clauses. I tried a variationof this, where I supplemented the test table with a char(2) column, so Icould factor out that the WITH clauses themselves were not the culprits.CREATE TABLE realthing (realta real NOT NULL,lasttwo char(2) NOT NULL)goINSERT realthing (realta, lasttwo)SELECT r, right(r, 2)FROM (SELECT r = convert(real, checksum(newid()))FROM Northwind..Orders aCROSS JOIN Northwind..Orders b) AS fgoDBCC DROPCLEANBUFFERSgoDECLARE @start datetimeSELECT @start = getdate()SELECT SUM(CASE right(realta, 2)WHEN '99' THEN 1WHEN '49' THEN 1WHEN '39' THEN 1ELSE 0 END)FROM realthingSELECT datediff(ms, @start, getdate()) -- 20766 ms.goDBCC DROPCLEANBUFFERSgoDECLARE @start datetimeSELECT @start = getdate()SELECT SUM(CASE WHEN right(realta, 2) LIKE '[349]9' THEN 1 ELSE 0 END)FROM realthingSELECT datediff(ms, @start, getdate()) -- 8406 ms.goDBCC DROPCLEANBUFFERSgoDECLARE @start datetimeSELECT @start = getdate()SELECT SUM(CASE lasttwoWHEN '99' THEN 1WHEN '49' THEN 1WHEN '39' THEN 1ELSE 0 END)FROM realthingSELECT datediff(ms, @start, getdate()) -- 920 ms.goDBCC DROPCLEANBUFFERSgoDECLARE @start datetimeSELECT @start = getdate()SELECT SUM(CASE WHEN lasttwo LIKE '[349]9' THEN 1 ELSE 0 END)FROM realthingSELECT datediff(ms, @start, getdate()) -- 1466 ms.Thus, when using the char(2) column LIKE is slower despite that thereis only one WHEN condition. So indeed it seems that right(realta, 2)is computed thrice in the first test.Another funny thing is the actual results from the queries - they aredifferent. When I ran:select count(*) from realthing where lasttwo <> right(realta, 2)The result was about half of the size of realthing! I can't see thatthis difference affects the results though.Now, your article had a lot more tests, but I have to confess thatyou lost me quite early, because you never discussed what is theactual problem. Since you are working with floating-poiont numbersthere is a great risk that different methods not only has differentexecution times, but also gives different results.--Erland Sommarskog, SQL Server MVP, Join Bytes!Books Online for SQL Server SP3 athttp://www.microsoft.com/sql/techin.../2000/books.asp

View 2 Replies View Related

What Is The Purpose Of Having SqlDataReader Here?

Jul 23, 2007

May I know what is the purpose of having SqlDataReader in Example A? I can see the same output when I tried out both. Should I use Example A or Example B? Currently, I'm using Example B since it is lesser code.Example A Dim objDR As SqlDataReader 'Create Data Reader

LoginConn.Open()
strSQL = "SELECT CountryID, CountryName FROM Country ORDER BY CountryName "
cmd = New SqlCommand(strSQL, LoginConn) objDR = cmd.ExecuteReader() 'Populate the DataReader ddlNationality.DataSource = objDR ddlNationality.DataBind() ddlNationality.SelectedValue = dvUserProfile.Item(0)("Nationality")LoginConn.Close()  Example BLoginConn.Open() strSQL = "SELECT CountryID, CountryName FROM Country ORDER BY CountryName " cmd = New SqlCommand(strSQL, LoginConn) ddlNationality.DataSource = cmd.ExecuteReader() 'Populate the DataReader ddlNationality.DataBind() ddlNationality.SelectedValue = dvUserProfile.Item(0)("Nationality")LoginConn.Close()

View 2 Replies View Related

MSDE Examples?

Apr 29, 2004

Does MSDE have the PUB database example in it? Just wondering before I download it.

View 2 Replies View Related

SQL Replication For DR Purpose

Sep 26, 2005

Can you really use the SQL replication to mirror data to another server for the purposr of DR ? What is the best method ? I would want to be able to switch to DR very quickly, allowing users to continue work. Or is there something I should know ? I would be very grateful for any help. :D

View 3 Replies View Related

What Is The Purpose Of Using WITH NOLOCK

Aug 12, 2013

What is the purpose of using WITH(NOLOCK)?

View 3 Replies View Related

Purpose Of The Sql Row Type

Oct 30, 2007

From a research paper I got to know that in transformation of one to many relation ship, in the "many type we have collection atribute consists of attribuet key from the one type. If we have a single key we will use a collection of simple type. Otherwise, we will have a collection of ROW type.

My probelm here is,is there any conditions to be cecked before using ROW type?Can't we use MULTISET instead of ROW type alone?

Please help me out by ansereing this.

Thanks

View 1 Replies View Related

Purpose Of 0E0, 100E0

Mar 28, 2008

In Chapter 7 of Microsoft Press "Inside Microsoft SQL Server 2005: T-SQL Querying" about use of TOP and APPLY, the authors use "TOP(0E0) PERCENT to TOP(100E0) ". What is the purpose of this 0E0, 100E0 notation?

View 5 Replies View Related

SQLCE And WPF Examples?

Jan 3, 2007

Hello all,

I want to use SQLCE and WPF.

Can anyone direct me to some example code.

two way binding with a sqlceResultSet would be a great start.

(last inquiry was in Aug of 06)

Thanks

Mike (still trying to get the latest tech to work together) Greenway

View 6 Replies View Related

Where To Find Examples

Jun 30, 2006

Hi!

Where can i find examples of T-SQL executed by one instance of SQL Server 2000 to communicate to a 2005 SQL Broker instance (both located on the same server)?

thanks for your help!

View 2 Replies View Related

PURPOSE OF TRIGGERS IN SQL SERVER

Feb 21, 2008

WHY DO WE USE TRIGGERS IN SQL SERVER2005.
 WAT IS ITS IMPORTANCE.
AND SOME SAMPLES
PLEASE GIVE ME SOLUTIONS

View 2 Replies View Related

Chart Examples - Advanced

Mar 28, 2006

Hello, Can anyone direct me to some sample charts created with 2000 Reporting Services? Looking for the advanced capabilities and quality of the charts.

Thanks
SactoJoe

View 3 Replies View Related

Purpose Of Dtproperties Table

Feb 4, 2002

What is the purpose of the dtproperties table? I looked in BOL and the references are pretty thin.

View 1 Replies View Related

What Is The Purpose Of A Database Owner

Dec 28, 2013

What is the purpose of a database owner i.e. the dbo.DBNAME that comes before the name of the database?

View 7 Replies View Related

What Is The Purpose Of Cube And ROLLUP?

Mar 30, 2007

Hai all !

What is purpose of Cube and Rollup?
Can u explain with small example?

Regards
Umapathy

Umapathy

View 1 Replies View Related

Databanks As Test-examples

Nov 21, 2007

hican someone help me. i am looking for free databanks. i could use asexamples for testing the usage of them. just for a start getting intothis field.i appreciate your help. thx ann xx

View 1 Replies View Related

What Is The Purpose Of The ROWGUIDCOL Property?

Dec 4, 2007

Greetings,What is the point of Microsoft defining a ROWGUIDCOL property that canbe attached to a 'uniqueidentifier' column? This is defined as a columnthat is 'globally unique', but doesn't the uniqueidentifier datatypealready guarantee that? To make matters more confusing, they tell youin Books Online to add a Unique constraint because ROWGUIDCOL does notguarantee uniqueness...so what's the point?Apparently the only functionality attached to this property is that onlyone such column can exist per table and that it can be queried using the$ROWGUIDCOL keyword in SQL.Can anyone tell me the rationale for when to use this and when not to,or what the purpose of this property is?Thanks,Sam BendayanDB ArchitectUltimate SoftwareJoin Bytes!*** Sent via Developersdex http://www.developersdex.com ***

View 2 Replies View Related

WriteBak Reaktime Examples

Jul 20, 2005

Hello there:I am trying to configure an excel worksheet as an Writebackapplication but I want to block some cells in the page and combiningcell protecion does nos alloudm to insert rew rowns

View 2 Replies View Related

Report Services Examples.. Please.. VS.NET

Jul 20, 2005

Hi..Im newbie on Report Services with VS.NET... I made a cube on olap.. andI try to lear some mdx for my reports..But, in the report designer... I need a lot of help..Please.. anybody.. can help meĻ??Thanks a lot...!Karina Gamez*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 1 Replies View Related

Examples For Using DirectRow Method?

Jul 6, 2006

Hi!

I was just wondering if there are any examples on how to work with the Script Editor, and more specifically how to use the DirectRow method? I've seen some examples that say that the editor automatically creates the methods DirectRowTo<output buffer>, but it doesn't say how that is done. If I just specify Row.DirectRow(output buffer #), it says that the method is protected.

Any help or just pointing me in the right direction would be greatly appreciated!

Thanks!

Jeff Tolman
E&M Electric
jeff.tolman@enm.com

View 4 Replies View Related

SSIS Programming Examples

Mar 28, 2006

I have been creating SSIS packages programmatically and have run into somewhat of a dead end. I have found the examples provided with the SQL 2005 install very helpful, but they only cover setting up three tasks: Sort task, OleDB Source and a Flat File Destination.

Does anyone have any examples or knows of examples of using the Merge Join task and the Conditional Split task?

I'm doing it all programmatically and so far I'm having trouble finding much in the way of documentation or examples.

Any help would be great!

Thanks,

Mark

View 8 Replies View Related

User Without Login Purpose

Nov 16, 2006

HI, we have a database that has a user created without login. I was wondering why using a user without login? Is there a reason for this? Can we use this user and how since it is not mapped to any login?

Thank you,
Ccote

View 8 Replies View Related

ADS Wizard, Tutorials And Examples - Please Help.

Oct 26, 2006

Hi,

I'm new to SQL Server Technology and am trying to learn how to create a Mobile Device application and to sync it with a desktop application that uses Access. I have found a lot of information but some of it doesn't seem to make sense.

I found this blog: http://blogs.msdn.com/sqlservereverywhere/archive/2006/08/29/729730.aspx which is the announcement of Access Database Synchronizer (ADS) CTP. I downloaded it and installed it with all the prerequisites. This is the part i can't understand:

"The CTP setup installs the desktop component required for synchronizing Microsoft Access database with SQL Server Everywhere Edition database on the device."

I cannot seem to find the desktop component to try out! The Readme shows you how to pull and push data but i can't see where the desktop data sync wizard is located. Should there be something installed on my desktop that i can see?

Also, there doesn't seem to be much help or examples around on this component as yet. Can anyone point me in the right direction for examples, help, or tutorials on this.

This paragraph also confuses me:

"Note: As of today only SQL Server Mobile Edition is available for devices. SQL Server Everywhere Edition whould be available for devices at time of SQL Server Everywhere Edition RTW whihc is planned for November 2006".

Does this mean SQL Everywhere won't work on mobile devices until November?

Sorry for all the questions but i'm still trying to learn this stuff so i can write my application for Windows CE. Thanks in advance.

View 8 Replies View Related

Where Do I Find The Examples That Come With Sql Server

Apr 3, 2006

books online mentions examples stored on the pc when sql is installed, but the examples are not on my machine. i know they are on the disk somewhere, but i dont have the disk. i have tried going to add remove programs and adding extra sql components but i cant find the examples there either. can anyone tell me where to find them?

View 1 Replies View Related

How Do You Set Up And Use Endpoints? Examples Required

Jun 20, 2007

i have posted here a few times on my endpoint issues but i cant find a resolution so im approaching the issue from a different angle. can you guys tell me how you create and consume endpoints, preferably with the endpoint code, the url you use to see the wsdl, and any network/pc settings you may have altered to get endpoints to work. im looking for tips or steps that may not be included in basic endpoint tutorials. I really am stuck and have no idea what else to try. thanks all

View 3 Replies View Related

SQL Northwind End To End Database Solutions (examples)

Apr 30, 2004

Does anyone know where I can find a Northwind end to end database solutions (examples) written in ASP.NET (VB). I would like to reverse engineer this project to learn more about ASP.NET?

Thanks.

View 1 Replies View Related

New - Learning By Code Examples - Need Guidance

Feb 25, 2005

Hi

I'm learning by going through the tutorials and such and modifying the code to try and learn how to do more and different things.

I have a MSDE Database, and I'm building a query from the WebMatrix Code Builder.

I can get a Select and Where to work on a "Category" colum as String; to return from a text box control (where I enter the name) and on button click.

What I would like to learn how to do and am having trouble is do a select Where "Category" (string) and "Status"(Int) are the same.

I have two Seperate Textboxes after i make the Where / And Query, but I'm not sure i have the button click code right.

I have included the code below - Sorry if this is so basic ;-) - The Sub_Button1 Click is at the end.


Function ShowRecords(ByVal category As String, ByVal status As Integer) As System.Data.DataSet
Dim connectionString As String = "server='(local)'; trusted_connection=true; database='SalesContacts'"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT [Contact].* FROM [Contact] WHERE (([Contact].[Category] = @Category) AND ("& _
"[Contact].[Status] = @Status))"
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dbParam_category As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter
dbParam_category.ParameterName = "@Category"
dbParam_category.Value = category
dbParam_category.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_category)
Dim dbParam_status As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter
dbParam_status.ParameterName = "@Status"
dbParam_status.Value = status
dbParam_status.DbType = System.Data.DbType.Int32
dbCommand.Parameters.Add(dbParam_status)

Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function

Sub Button1_Click(sender As Object, e As EventArgs)
DataGrid1.DataSource = ShowRecords(CStr(TextBox1.Text)&(CInt(TextBox2.Text)))
DataGrid1.DataBind()
End Sub

View 4 Replies View Related

Any Good Audit Trail Examples?

Jun 17, 2002

Hi Guys!

What's the best way to keep an audit trail of every insert, update, and delete of a certain table? Any example code out there? I'm thinking in terms of a trigger for each event, for instance, the update trigger would insert a new record into the audit table with a field for each column in the deleted table and a field for each column in the inserted table.

Thanx

Dave

View 3 Replies View Related

What Is Purpose Of Semi Colon After Procedure Name

Jul 23, 2005

I've seen some system sp's that have a semi colon and number after thethe name such ascreate procedure sp_procedure_params_rowset;2what does this do?

View 1 Replies View Related

Purpose Of OUTPUT Keyword In Sql Server

May 17, 2006

hello sirspurpose OUTPUT keyword with examples

View 3 Replies View Related

Purpose Of Writing Dates In This Format

Jan 15, 2007

hi Experts,what is the purpose writing a date in the following format:where x.event_date >= {ts '1980-01-01 00:00:00'}versus like this:where x.event_date >= '1980-01-01 00:00:00'what benifit does it add to later form of writing?Thanks in advance.schal.

View 4 Replies View Related

Any Idea What The Purpose Of This SPROC Might Be? (no Prizes, Sorry!)

Jan 19, 2007

I've been asked to document an application and I'm going through allthe Stored Procedures and trying to work out what they're supposed todo.Can anyone give me an idea of what the Stored ProcedurewsBookingListsGetAll below is trying to achieve? Is it incomplete? Ican't see any reason to pass in the Parameter, and what is the UNIONSELECT 0 all about?Many thanksEdwardCREATE Procedure wsBookingListsGetAll@DebtorIDvarchar(15)Asset nocount onSELECTfldBookingListIDFROMtblWsBookingListUNIONSELECT 0returnGO/* Table def */if exists (select * from dbo.sysobjects where id =object_id(N'[dbo].[tblWSBookingList]') and OBJECTPROPERTY(id,N'IsUserTable') = 1)drop table [dbo].[tblWSBookingList]GOCREATE TABLE [dbo].[tblWSBookingList] ([fldDebtorID] [char] (15) COLLATE Latin1_General_CI_AS NOT NULL ,[fldBookingName] [varchar] (50) COLLATE Latin1_General_CI_AS NOT NULL,[fldAddressCode] [char] (15) COLLATE Latin1_General_CI_AS NOT NULL ,[fldEmail] [varchar] (250) COLLATE Latin1_General_CI_AS NOT NULL ,[fldFirstName] [varchar] (100) COLLATE Latin1_General_CI_AS NOT NULL ,[fldLastName] [varchar] (100) COLLATE Latin1_General_CI_AS NOT NULL ,[fldBookingListID] [int] IDENTITY (1, 1) NOT NULL ,[fldInvoiceNumber] [varchar] (15) COLLATE Latin1_General_CI_AS NULL ,[fldPayeeID] [char] (15) COLLATE Latin1_General_CI_AS NULL) ON [PRIMARY]GO

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved