Unresolved SQL Server 2005 Issues - Getting Real Fedup With It!

Nov 22, 2007

So for the last week of my life, literally, I have been trying to import excel files, text files, etc through the bcp utility, link server and also trying bulk insert....I am really, really tired of this not working and I am starting to think there is a bug in express. I first thought these issues might have to do with Vista but I have even tried and failed with XP SP2. I am not new to SQL Server, nor am I a new developer - I have over five years experience so I am really pissed about it at this point! I know most professional developers use SQL Server 2005 Enterprise or something other than Express which is why I am probably not getting answers. btw, this is not the first time I have posted about these issues either. I have referenced multiple sources including forums, books on-line and I even resorted to getting a SQL Server 2005 EXPRESS book for dummies! I have enabled remote connections for both named pipes and tcp/ip. I have started the sql browser service. I have given the correct permissions to the file I want to import and to the table I want to import the data to. The file contains the int values 1,2,3,4,5,6,7,8,9 --> I have even tried saving this file as a .csv -- thanks a whole bunch sql server 2005 dev team for getting rid of the import/export wizard found in 2000, arrrrrgh!

BULK INSERT TestDB.dbo.tblTestData
FROM 'C:datamyData.txt' WITH (DATAFILETYPE = 'char', FIELDTERMINATOR =',');
GO

Msg 4864, Level 16, State 1, Line 1
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 1 (columnValue).

Can ANYONE give me a real answer on h ow I can get this to actually work?

-Brian

View 3 Replies


ADVERTISEMENT

SQL 2005 Backup Failing [UNRESOLVED]

Feb 7, 2007

Environment: SQL 2005 Workgroup Ed. (part of SBS 2003 R2 Premium)

I have a database attached to SQL 2005 that is on my D: drive. I'm trying to run a full backup of this database to a backup device also on D:. The first time I ran the backup it worked fine, then I installed SQL 2005 SP1 and now it's failing. The error message is:

quote:
Backup failed for Server 'MYSERVER'. (Microsoft.SqlServer.Smo)
System.Data.SqlClient.SqlError: Write on "My Backup Device(D:BackupMyBackupDevice.bak)" failed: 112(There is not enough space on the disk.)(Microsoft.SqlServer.Smo)


In the event viewer, the following events are logged in the Application log:

quote:
Source: MSSQLSERVER
Category: (6)
Event ID: 3041
Description:
BACKUP failed to complete the command BACKUP DATABASE MyDatabase. Check the backup application log for detailed messages.

quote:
Source: MSSQLSERVER
Category: (2)
Event ID: 18210
Description:
BackupMedium::ReportIoError: write failure on backup device 'D:BackupMyBackupDevice.bak'. Operating system error 112 (There is not enough space on the disk.).


If I do the backup to the MSSQL default backup directory (on C: ), the backup completes successfully. If I try to back up the master database (on C: ) to the backup directory I created on D:, the backup completes successfully. If I try to back up the master database to the MSSQL default backup directory (on C: ), the backup completes successfully.

The SqlServer and SqlAgent processes are both running under a domain user account, and that account has full control of my backup directory on D:. I should also mention that my D: drive has over 100GB free, and the database is only 330MB. It is a simple database model.

I've searched all day today trying to find the solution to this issue, and I can't find anything relevant. Could someone please help me!!! I'm about at my wit's end!

Thanks in advance,
Greg

View 20 Replies View Related

SQL Server 2005 REAL Annoying Problem

Jan 22, 2008

I am having a problem connecting to my SQL Server 2005 database at the same time with SQL Management Studio Express and from the website at the same time.
Everytime I want to view any pages in my site that access the database, I have to close management studio and restart the server for some reason or i get a failed login error message.
Is it NOT possible to work on the database at the same time as viewing pages in the website that access the database?
This freaking error is realy starting to bug me.
I sure hope that there is a work around or something for this.

View 7 Replies View Related

Real Simple Liscensing Question For Sql Server 2005.

Apr 11, 2006

Hell, I host web pages on a server(s) that I own, located in a datacenter.I am trying to figure out how to properly liscnese sql server 2005.I have called microsoft, and the people i talk to dont seem to understand my situation.  They keep asking me about the number of employess i have, which is totally irrelevant.  Let me give you a basic example.Example 1.My personal web page has a blog on it.  The blog data is stored in a SQL database.  Its a popular blog, thousands of anonymous people reading my blog every month via my webpage.  The only "thing" accessing the SQL databse is an asp.net script i write, which then turns around and presents the data via html over the www.  just like every other blog in the universe. Example 2.I sell artwork over the internet via my web page.   My web page uses a shopping cart system which makes use of an SQL database to keep track of inventory and orders etc.  No one ever tries to connect to my database, they just use the shopping cart on my web page which of course connects to the database.Now according to the MS liscensing documentation it seems that i can buy sql server w/ 5 device CAL's.  Since I only have 1 or 2 webservers accessing the database server, that should be no problem right?So my basic question is this:   is a single Device CAL enough to allow one webserver to connect to one sql server and then show dynamic content to thousands of anonymous users (whoever happens to visit my sites?).Thank you very much for any help you can provide.

View 1 Replies View Related

Real Problem Installing SQL Server Express 2005

Oct 7, 2006

When I first installed MS SQL Server 2005 Express Editon, I didn't I selected Windows Auth instead of mixed mode, so I uninstalled sql server and then attempted to reinstall. On the earlier installtion I did setup to instances which show in the "Control Panel/admin tool/services". Anyway, I used the unistall through the control panel, but on installing again it told me that I had instances aready running and needed to stop them. Couldn't work out how to do that. So after many different things, including using the MS's removal tool and windows installer clean up, I still failed. Now however I get the following error message:

Setup failed because Service MSSQL$SQLExpress is disabled for the current hardware profile. Services must be set with the current Hardware Profile logon property profile enabled. For more information on how to enable the hardware profile logon property refer to the product documentation.

Can someone help?

Cheers

Dave

View 3 Replies View Related

Oracle 10G's Real Application Clusters (RAC) Counterpart In SQL Server 2005?

Jul 27, 2007

Hello Everyone,

Does SQL Server 2005 has a counterpart to Oracle 10G's Real Application Clusters (RAC)?

http://www.oracle.com/technology/products/database/clustering/index.html

Regards,
Joseph




View 3 Replies View Related

SQL Server 2000/2005 Tutorial For Complex And Real Life Queries

Dec 13, 2007

I am not very good in queries. Could you please suggest me some web site/Tutorial/Artical where i can get Study Material for complex and real life queries. I know the syntexes, I just need to practice queries to enhance my skills

View 1 Replies View Related

SQL Server 2005 Counterpart On Oracle 10G's Real Application Clusters (RAC) Counterpart?

Jul 27, 2007




Hello Everyone,



Does SQL Server 2005 has a counterpart to Oracle 10G's Real Application Clusters (RAC)?


http://www.oracle.com/technology/products/database/clustering/index.html



Regards,

Joseph



View 1 Replies View Related

Still Unresolved - Error: 26 - Error Locating Server/Instance Specified

Jan 11, 2008

I'm still having this problem after hours of research. I've tried changing my connection string, changing the name of my instance, reconfiguring SQL Express, and even went so far as to take my firewall down completely when adding Sql Browser and opening port 1434 to the exceptions list didn't work.

I've read the blog at http://blogs.msdn.com/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx by Xinwei Hong - it seemed to be a nice approach to this problem and has obviously helped numerous people, but sorry Xinwei, it's not working for me.

I get the following error message when I try to use the Login control (out-of-the-box):

Server Error in '/' Application.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings, SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

SQLExpress database file auto-creation error:



The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:


If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.

Source Error:





An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: (Edited to preserve page formatting)
[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800131
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +737554
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +114
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +421
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +133
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +27
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +47
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +68

[HttpException (0x80004005): Unable to connect to SQL Server database.]
System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +124
System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +86
System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +25
System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +397


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433



When I click the [>] arrow in the upper-right corner of the login control and choose "Administer Website", click the "Select a single provider for all site management data" only one provider is listed: AspNetSqlProvider (default, selected). When I click the "Test" link, it hesitates for a while, then finally gives me the following screen:


Provider Management
Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.

I've verified (reverified, and re-reverified - to the point of performing several copy-paste functions from SQL Server Management Studio Express) the server and instance names. They are correct. I can connect to the databases through the Server Management Studio, but not through my websites.

I've tried using ServerInstance as well as Server\Instance, Server/Instance, and ServerInstance, port# - ALL to no avail.

This is all being done through localhost, so I don't see that this should be a DNS issue. I've verified that my SQL Server Browser service is running (and have restarted it after various configuration changes). I've added Sql Server Browser to the list of exceptions as well as opened up port 1433 and 1434 on my firewall. I've even tried taking my firewall down completely to run tests. And still I get that error.

[Edit: Accidentally posted prematurely]

Continuing on... my CURRENT connection string is as follows:


<connectionStrings>

<add name="pnpConnection" connectionString="Data Source=GLORIALOCALDEV,1433;Initial Catalog=pnpdb;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>


I would like to be pulling my hair out right now, but I've just about ripped it all out, so I'm running short on that as of yet. Does anyone have a solution for this problem? There may be something larger going on, since when I use the Login Control and set the "VisibleWhenLoggedIn" property to "False", it hides the control even when there's noone logged in (and nothing in the aspnetdb database.


TIA,
Jason Satterfield

View 10 Replies View Related

The Unresolved Problem

Jun 8, 2006

Hi Guys
i have been trying so hard to get an answer for my problem but still havent found a solution
Well my problem is i have got two tables
table 1
Companyname id year volume_for_jan vol_for_feb.....vol_dec
abc 1 2000 34 333 ......555
2 2000 33 22 666

table 2
Companyname id year volume_for_jan vol_for_feb.....vol_dec
rrr 44 2001 55 66.............888
24 2001 22 35 454

each table has almost 800000 rows

I need to generate a report out of these tables which should be in the following format:

Company name Id Year Vol_for_jan Vol_for_feb.........
abc 1 2000 34 33
2 2000 33 22
rrr 44 2001 55 66

How shall i do that???

I dont have any indexes on the tables coz there is no unique field!

Pls help me guys

View 3 Replies View Related

Using Express 2005 As A Database For A Real Website

Oct 23, 2006

HiI’m abut developing a website that has a 200 megabytes  SQL database ,in my estimation  the maximum online users are 100 users for first year , I want to make shore a SQL express 2005 database  in good enough for my purpose. Another question is how much can I count on a SQL express 2005 database? I mean how much it could be grown and abut security (I mean is it as secure as SQL server?). Thanks.

View 3 Replies View Related

-2147217900 (Native Error 8649) - Unresolved

May 1, 2008


Hi,

Could use a lil' help on a query that works on one server, but not the other.
Thx in advance !!!!!

Marcus

===========================

Builds:


Svr1:
Windows 2003 R2 SP2 Enterprise
IIS 6.0
SQL 2005 Enterprise SP2
WSUS 3.0 SP1
SCCM 2007 RTM



Svr2:
Windows 2003 R2 SP2 Standard
IIS 6.0
SQL 2005 Standard SP2
WSUS 3.0 SP1
SCCM 2007 RTM

Svr2 query works fine, Srv1 query returns this error:


An error occurred when the report was run. The details are as follows:
The query has been canceled because the estimated cost of this query (2147483647) exceeds the configured threshold of 100000. Contact the system administrator.






Error Number:
-2147217900

Source:
Microsoft OLE DB Provider for SQL Server

Native Error:
8649


This is the query language:

SELECT DISTINCT
dbo.v_R_System.Netbios_Name0 AS [Machine Name],
dbo.v_R_System.Resource_Domain_OR_Workgr0,
dbo.v_GS_OPERATING_SYSTEM.Caption0 AS [Operating System Caption],
dbo.v_R_System.Operating_System_Name_and0 AS [Operating System],
dbo.v_GS_OPERATING_SYSTEM.Version0 AS [Operating System Version],
dbo.v_GS_OPERATING_SYSTEM.CSDVersion0 AS [Service Pack Version],
dbo.v_GS_COMPUTER_SYSTEM.Manufacturer0 AS [System Manufacturer],
dbo.v_GS_COMPUTER_SYSTEM.Model0 AS [System Model],
dbo.v_GS_PC_BIOS.SerialNumber0 AS [System Serial Number (if Available)],
dbo.v_GS_PROCESSOR.MaxClockSpeed0 AS [Processor Speed (GHz)],
dbo.v_GS_COMPUTER_SYSTEM.NumberOfProcessors0 AS [Number of Processors (or Cores)],
dbo.v_GS_X86_PC_MEMORY.TotalPhysicalMemory0 AS [Memory (KBytes)],
dbo.v_GS_LOGICAL_DISK.Size0 AS [Disk Space (MB)],
dbo.v_GS_LOGICAL_DISK.FreeSpace0 AS [Free Disk Space (MB)],
dbo.v_RA_System_IPAddresses.IP_Addresses0 AS [IP Address],
dbo.v_RA_System_MACAddresses.MAC_Addresses0 AS [MAC Address],
dbo.v_GS_PC_BIOS.Description0 AS [BIOS Description],
dbo.v_GS_PC_BIOS.ReleaseDate0 AS [BIOS Release Date],
dbo.v_GS_PC_BIOS.SMBIOSBIOSVersion0 AS [SM BIOS Version],
dbo.v_GS_OPERATING_SYSTEM.WindowsDirectory0 AS [Windows Install Directory]

FROM dbo.v_R_System

INNER JOIN dbo.v_GS_OPERATING_SYSTEM ON dbo.v_GS_OPERATING_SYSTEM.ResourceID = dbo.v_R_System.ResourceID
INNER JOIN dbo.v_GS_SYSTEM_ENCLOSURE ON dbo.v_GS_SYSTEM_ENCLOSURE.ResourceID = dbo.v_R_System.ResourceID
INNER JOIN dbo.v_GS_COMPUTER_SYSTEM ON dbo.v_GS_COMPUTER_SYSTEM.ResourceID = dbo.v_R_System.ResourceID
INNER JOIN dbo.v_RA_System_IPAddresses ON dbo.v_RA_System_IPAddresses.ResourceID = dbo.v_R_System.ResourceID
INNER JOIN dbo.v_RA_System_MACAddresses ON dbo.v_RA_System_MACAddresses.ResourceID = dbo.v_R_System.ResourceID
INNER JOIN dbo.v_GS_X86_PC_MEMORY ON dbo.v_GS_X86_PC_MEMORY.ResourceID = dbo.v_R_System.ResourceID
INNER JOIN dbo.v_GS_PROCESSOR ON dbo.v_GS_PROCESSOR.ResourceID = dbo.v_R_System.ResourceID
INNER JOIN dbo.v_GS_PC_BIOS ON dbo.v_GS_PC_BIOS.ResourceID = dbo.v_R_System.ResourceID
INNER JOIN dbo.v_GS_LOGICAL_DISK ON dbo.v_GS_LOGICAL_DISK.ResourceID = dbo.v_R_System.ResourceID
INNER JOIN dbo.v_FullCollectionMembership ON (dbo.v_FullCollectionMembership.ResourceID = v_R_System.ResourceID)

WHERE (dbo.v_GS_LOGICAL_DISK.DeviceID0 = 'C:')
AND dbo.v_FullCollectionMembership.CollectionID = 'in00000f'
Order by dbo.v_R_System.Netbios_Name0

View 8 Replies View Related

MSDE Or SQL 2005 Deployment Resources - Real World Input

Feb 9, 2006

I have traditionally done web app and client server programming and am have been playing around with a new tool (Win forms) app that I eventually want to distribute to other developers and a couple of business people in our organization. I have done apps in the past that all connect to a central server for data access. The I'm working on now will have an individual DB per user and should be available locally for a desktop version of the software.

I am looking for more resources on things to consider when deploying an app with either MSDE or SQL 2005 Express. More specifically, items like long term maintenance of the db once it's installed with the user, etc. (DB bloat, transaction files, auto maintenance routines I may want to build in, etc)

I have seen all of the msdn docs on what you need to deploy (and how to do it), but I'm looking fro input from people that have deployed it and any significant pitfalls they have run into with that sort of deployment.

Any links or book references would be appreciated, thank you,

Cy Huckaba

View 1 Replies View Related

Implicit Conversion Of Char Value To Varchar Cannot Be Performed Because The Collation Of The Value Is Unresolved..

Nov 12, 2007

I got this erorr when trying to create my stored proc,

What do i need to fix, and how do i fix it?!!

Msg 457, Level 16, State 1, Procedure PROC_DAILY_ACTIVITY, Line 13

Implicit conversion of char value to varchar cannot be performed because the collation of the value is unresolved due to a collation conflict.




Code Block
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

-- =============================================
-- Author: <Zaccheus,Tenchy>
-- Create date: <NOVEMEBER,12,2007>
-- Description: <Reporting stored procedure,DAILY ACTIVITY,>
-- =============================================
CREATE PROCEDURE [dbo].[PROC_DAILY_ACTIVITY]
(@Region_Key int=null)
AS
BEGIN
SELECT
Region_Key,
Null as Customer_Code,
Non_Customer_Activities.Question_code,
Non_Customer_Activities.Description,
Region AS Region,
Name AS Territory_Name,
Non_Customer_Activities.Que_Desc AS Store_Name,
Non_Customer_Activities.Logged_Time AS TheDate,
Non_Customer_Activities.response AS Response,
Null as is_Visit_Fg
FROM [FSSRC].[dbo].Qry_Sales_Group Sales_Group
INNER JOIN
(Select QH.[question_code]
,Question_Header.Description
,CONVERT(datetime,DATEADD(day, (qh.cycle_day-1), p.start_date),6) Logged_Time
,SUBSTRING([entity_code],1,5) SR_Code
,[response]
,Territory_Code SR_Territory_Code
,'Not Customer Related' Que_Desc
From question_history QH
INNER JOIN Period P
ON p.period_code = qh.period_code
INNER JOIN [RC_DWDB_INSTANCE_1].[dbo].[Tbl_Territory_In_Sales_Responsible] as Territory_In_Sales_Responsible
ON Territory_In_Sales_Responsible.SalesPerson_Purchaser_Code=SUBSTRING([entity_code],1,5) COLLATE Latin1_General_CI_AS
INNER JOIN dbo.questions Question_Header
ON Question_Header.question_code = QH.question_code
WHERE [entity_code] like '%.USER%'
AND Question_Header.Question_Code IN('AME01','ASE01','ACO01','ALU01','AOS01','APH01','ATR01','ATE01','ACR06','ACR05','ACR02','ACR03','ACR08','ACR07')
AND CONVERT(datetime,DATEADD(day, (qh.cycle_day-1), p.start_date),6) = '11/9/2007'
) Non_Customer_Activities
ON Sales_Group.Code = Non_Customer_Activities.SR_Territory_Code
UNION ALL
SELECT
Customer_Activities.Customer_Code,
NULL,
NULL,
Region AS Region,
Name AS Territory_Name,
Customer_Activities.Customer_Name AS Store_Name,
Customer_Activities.Logged_Time AS TheDate,
NULL AS Response,
is_Visit_Fg
FROM [FSSRC].[dbo].Qry_Sales_Group Sales_Group
INNER JOIN
(Select distinct time_log Logged_Time
,[entity_code] Customer_Code
,[name] Customer_Name
,Territory_Code Cust_Territory_Code
,MAX(is_Visit_Fg) Is_Visit_Fg
From question_history QH
INNER JOIN Period P
ON p.period_code = qh.period_code
INNER JOIN dbo.questions Question_Header
ON Question_Header.question_code = QH.question_code
INNER JOIN [FSSRC].[dbo].[customer]
ON Entity_Code = [customer_code]
INNER JOIN [FSSRC].[dbo].[visit] V
ON V.[customer_code] = QH.[entity_code]
AND V.[period_code] = QH.[period_code]
AND V.[cycle_day] = QH.[cycle_day]
INNER JOIN [RC_DWDB_INSTANCE_1].[dbo].[Tbl_Territory_In_Sales_Responsible] as Territory_In_Sales_Responsible
ON Territory_In_Sales_Responsible.SalesPerson_Purchaser_Code=[sales_person_code] COLLATE Latin1_General_CI_AS
WHERE [entity_code] NOT like '%.USER%'
AND Convert(datetime,convert(Varchar,time_log,110)) = '11/9/2007'

GROUP BY
time_log
,[entity_code]
,[name]
,Territory_Code
) Customer_Activities
ON Sales_Group.Code = Customer_Activities.Cust_Territory_Code
WHERE @Region_Key=Region_Key
order by 4
END

View 2 Replies View Related

Real Experiences With 64 Bit SQL Server

Jul 20, 2005

I am about to buy some database hardware, and am considering buying adual 64-bit opteron server. In the past, we have run been running the32-bit version of SQL Server 2000.Has anybody tried the new 64-bit version of Sql Server 2000? Can weassume that something that works in the 32-bit world will work in the64 bit, or are we going to spend time debugging Microsoft code? Also,which flavor of 64-bit windows operating system did you use?Any experiences you want to share are much appreciated...-Cheers,Richard

View 2 Replies View Related

SQL Server For Real Time

Apr 12, 2007

Hi,



We currently have a propriety in memory DB that is used to store the latest transactions in the system and we have a service that copies the data to a SQL Server every couple of seconds - For historical reporting purpose.



We would like to move into a more standard DB as our real time DB, since we have scalability and availability issues. We taught about using SQL Server since this is the DB we know, but I'm not sure it's built to handle real time data.



Does someone has any experience in using SQL Server for "Real Time" applications?

Does someone has any experience in storing the data files on RAM?



Does MS has a solution similar to Oracle's TimesTen, which is their real time DB?



Thanks,

Avi G..

View 3 Replies View Related

Real Easy Newby Q: SQL Server

Oct 28, 2005

This Q is so easy I can't find the answer anywhere!
Why is SQL Server called 'Server' ? I understand it is a lot more capable and robust than Access but where does 'server' come into it.
I currently use ASP and Access for dynamic websites but it is time to move up a notch.
Do I just buy SQL Server, make a database, upload it to the same place as before and hey presto?
can I run lots of websites (on different domains and servers) from databases created with my single license standard edition?
Thanks
M

View 5 Replies View Related

SQL Server 2K Problem With Fractional Real Values

Jul 23, 2005

I have a field of type Real in my SQL 2K database. I stored a value of..35 in the field.When I "Open Table"->"Return All Rows" in the Enterprise Manager I getback .35 for the field value.I went to The SQL Query Analyzer and executed the following T-SQL:SELECT fieldFROM tableI got back 0.34999999 for the field.When running stored procs against the field I also get back 0.34999999.This is causing problems in my app. I can use the Round T-SQLstatement to get back the value I expect, but this causes appdevelopment problems. For a goof I put 1.35 in the field and T-SQL didreturn 1.35. This problem only seems to occur with 0.nnn values. Ialso tried a float data type for the field but I had the same problemsI had with real.Why is T-SQL returning 0.34999999 for my field?

View 1 Replies View Related

Viewing Commands Being Executed On Sql Server In Real Time

Sep 19, 2006

I saw a presentation last week where the speaker created some sorta sql server "watch window" (in Sql Server Management Studio I think) where he could watch all the commands being executed on his sql server database in real-time. For example he could navigate to web pages (that hit the database) and as he pressed buttons you could see the sql commands execute in this "watch window."  If other users hit the database at the same time you could see those sql queries execute as well.  I didn't think at the time to ask how he did it - does anyone know how to set this up?  I have a problem with my sql server right now and it would be useful to see which sql queries (etc) are being executed when.  Thanks in advance,J. Shane Kunklejkunkle@vt.edu

View 2 Replies View Related

How To Create A Real (not Virtual) Table From View1 && View2 Ni Sql Server?

May 11, 2006

Hello all,my question might be trivial but since my background isn't DB i'll dareto ask it any way:how to create a real (not virtual) table from view1 & view2 ni sqlserver?what should i do specificly in the sql server application & what is thesyntax for that?i thank all of you,groupy.

View 2 Replies View Related

SQL Server Does Not Exist Or Access Denied - A Real Doozzy And Not Your Standard Problem!!

Sep 26, 2006

Hi ,

I am running SQL Server Desktop Engine on Windows XP. I am developing in .NET framework v1.1.

I intend to u/g to the express edition 2005 however should this old version of the engine be OK (particularly considering that Windows updates are being often run)?

Main question.

For ages the database has worked well then one day recently (just after running a Windows update) the following error occurred SQL Server does not exist or access denied .

I followed my code and this is the result of an exception being thrown in my code due to one of two obvious possibilities.

Everything looks fine as far as SQL Server DEsktop Engine (including services and TCP/IP protocols. Yes I have check cliconf.exe and svrnetcn.exe !!)

I specified mixed mode access (at setup) and In .NET my connection string is :

ConnectionString = "Persist Security Info=false;IntegratedSecurity=sspi;Database=ShedDb;server=warehouse1";

I notice that when I try to login to the database engine with OSQL it does not recognise the original sa password??

Somehow this has been changed (I definitely have not)

Q1. Is it possible that a virus (Worm) could have done this?

Q2. I think that I am stuffed(sorry) because now the sa has changed I cannot perform any admin functions (like resetting the sa pw) Is there any way to change the sa password in this sitatuon?

Q3. The database is locally setup on my development system. When I use the above mentioned connection string I assume that because I do not mention a userid and password that database access is being achieved via Windows authentication (I did specify mixed mode at setup) Is this correct?

Q4. I can appreciate the severity of the sa password being altered. However if Windows authentication is being used by my application, why should this matter? How does Windows authentication work?

Q5. I do have a backup of all the databases including master, model, temp... (I think that the sa password is stored in master). Would the crude approach of simply copying the backup of these backup database files (like master.mdf and master.ldf) suffice in fixing this problem?

Any help would be appreciated.



Thanks

Andrew.

View 8 Replies View Related

(Project Real Implementation) Error Code: 0x80004005 OLEDB Connection To SQL Server

Mar 25, 2008

Hi List
Im trying to set up an implementation of Project Real --it works like this-
Create two system environment variables called REAL_Root_Dir and
REAL_Configuration with the values given below. Click on
Start -> Control Panel -> System. Go to the Advanced Panel, click Environment Variables button, then New in the System variables box.

If the Project REAL files were installed at C:Microsoft Project REAL, then the variable values will be:

Variable Name: REAL_Root_Dir
Variable Value: C:Microsoft Project REALETL

Variable Name: REAL_Configuration
Variable Value: %REAL_Root_Dir%REAL_Config.dtsconfig



The package OLEDB connections work like this
First read enviroment variable to get location of config file
Next read Config File to get connection string for Config Database
<?xml version="1.0"?>
<DTSConfiguration>
<Configuration ConfiguredType="Property" Path="Package.Connections[SQL - Configuration].Properties[ConnectionString]" ValueType="String">
<ConfiguredValue>Data Source=(local);Initial Catalog=DataWarehouseABC;Provider=SQLNCLI.1;Integrated Security=SSPI;</ConfiguredValue>
</Configuration>
</DTSConfiguration>
Next read Config database to get connection strings for Source and Destination databases



Destination database is called "DataWarehouseABC"
Source database is called "SnapshotABC"


the Source database OLEDB connection works 100%
however the destination OLDB connection we get this error below
PS--Both source and destination databases are on the same development machine , however both databases are restored bak files from another production machine







Error 1 Error loading LoadGroup_Daily.dtsx: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Login failed for user 'xxxxxx'.". An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Cannot open database "DataWarehouseABC" requested by the login. The login failed.".


Any ideas on how one OLEDB Connection in this package can get this corruption


thanks in advance
Dave

View 5 Replies View Related

SQL Server 2014 :: SSAS Stored Procs (CLR) - Identify Real Data Type Of MDX Value Returned From Expression

Feb 13, 2015

I have a SSAS stored procedure with a signature:

public Set DoSomthing(Set toBeProcessed, Set measuresToWorkWith)The set measurseToWorkWith is passed as {[Measures].[Measure1], [Measures].[Measure2] ...}

with the measures being real or query-scoped calculated members.

To get the value of the measure for each tuple in the set toBeProcessed, I create an Expression for each tuple (measure) in the set measuresToWorkWith then for each tuple in toBeProcessed call expression.Calculate(tuple) which returns a MDXValue.

My problem is that in order to make the code generic I need to get the real (.NET) data type of the MDXValue. The class only has explicit conversion methods ToInt16() etc which implies that the data type is known at design time.

However, if one of the measures is a query-scoped calculation then it could return a .NET double, int, bool or string.

If the measure is real then I can look up its metadata. However, it appears that if it is a formula (scoped member) then are all bets are off?

View 0 Replies View Related

SQL Server 2014 :: Gathering Stored Procedure Execution Time In Real Time?

Jun 11, 2015

Is there a way to keep track in real time on how long a stored procedure is running for? So what I want to do is fire off a trace in a stored procedure if that stored procedure is running for over like 5 minutes.

View 5 Replies View Related

Time In Sql Server Is Not The Real Time

Apr 18, 2007

Hi,when i create a new user in a .MDF file, the hour of creation in the field "createdate" of table "membership" is exactly 2 hours less than the time of my computer. Probably something to do with different hours between Europe and UK or ...How can i set the creation hour to exact the same hour of my computer?ThanksTartuffe

View 4 Replies View Related

Can Someone Help With This T-SQL Real Quick?

Nov 11, 2007

Hey guys... i cant figure this out for the life of me.  I have a long T-sql query, and when i enter the string "Rental" into the Listingtype, it says invalid column name "Rental" ... im not looking for the value to be a column, im looking for it to match the value in the ListingType column... here's the query:
 
 (

@StudioINT = NULL,
@Br1INT = NULL,
@Br2INT = NULL,
@Br3INT = NULL,
@Br4INT = NULL,
@OverBr4INT = NULL,
@CondoINT = NULL,
@ListingTypevarchar(10) = NULL,
@WindowAirINT = NULL,
@CentralACINT = NULL,
@BalconyDeckPatioINT = NULL,
@UseOfYardINT = NULL,
@DishwasherINT = NULL,
@WasherDryerINT = NULL,
@FireplaceINT = NULL,
@EIKINT = NULL,
@HardwoodFloorsINT = NULL,
@BroadbandNetINT = NULL,
@TVINT = NULL,
@ThermostatINT = NULL,
@LandlordNotPresentINT = NULL,
@SmokingINT = NULL,
@NoPetsAllowedINT = NULL,
@CatINT = NULL,
@MoreCatsINT = NULL,
@SmallDogINT = NULL,
@LargeDogsINT = NULL,
@DoorpersonINT = NULL,
@IngroundPoolINT = NULL,
@AboveGroundPoolINT = NULL,
@ElevatorINT = NULL,
@UseOfGarageINT = NULL,
@LaundryFacilitiesINT = NULL,
@HealthCenterINT = NULL,
@StorageAreasINT = NULL,
@WheelchairAccessINT = NULL,
@BusinessCentersINT = NULL,
@RentChargeMinINT = NULL,
@RentChargeMaxINT = NULL,
@DebugBIT = 1
)
AS

SET NOCOUNT ON

DECLARE @SQL VARCHAR(8000)

SET @SQL = '
SELECT

r.REListingID,
r.REListingDate,
r.Username,
r.ZipCode,
r.ListingType,
r.StudioFlag,
r.BRFlag1,
r.BRFlag2,
r.BRFlag3,
r.BRFlag4,
r.OverBRFlag4,
r.CondoFlag,
a.WindowAir,
a.CentralAir,
a.BalconyDeckPatio,
a.UseOfYard,
a.Dishwasher,
a.WasherDryer,
a.Fireplace,
a.EIK,
a.HardwoodFloors,
a.BroadbandNet,
a.TV,
a.Thermostat,
a.LandlordNotPresent,
a.Smoking,
a.NoPetsAllowed,
a.Cat,
a.MoreCats,
a.SmallDog,
a.LargeDogs,
a.Doorperson,
a.IngroundPool,
a.AboveGroundPool,
a.Elevator,
a.UseOfGarage,
a.LaundryFacilities,
a.HealthCenter,
a.StorageAreas,
a.WheelchairAccess,
a.BusinessCenters,
a.RentCharge,
a.RentFrequency
FROMdb_REListings as r
INNER JOINdb_RentalAmenities AS a ON a.REListingID = r.REListingID
WHERE1 = 1
'

IF @Studio IS NOT NULL
SET @SQL = @SQL + ' AND r.StudioFlag = ' + CONVERT(VARCHAR(20), @Studio)
IF @Br1 IS NOT NULL
SET @SQL = @SQL + ' AND r.BRFlag1 = ' + CONVERT(VARCHAR(20), @Br1)
IF @Br2 IS NOT NULL
SET @SQL = @SQL + ' AND r.BRFlag2 = ' + CONVERT(VARCHAR(20), @Br2)
IF @Br3 IS NOT NULL
SET @SQL = @SQL + ' AND r.BRFlag3 = ' + CONVERT(VARCHAR(20), @Br3)
IF @Br4 IS NOT NULL
SET @SQL = @SQL + ' AND r.BRFlag4 = ' + CONVERT(VARCHAR(20), @Br4)
IF @OverBr4 IS NOT NULL
SET @SQL = @SQL + ' AND r.OverBRFlag4 = ' + CONVERT(VARCHAR(20), @OverBr4)
IF @Condo IS NOT NULL
SET @SQL = @SQL + ' AND r.CondoFlag = ' + CONVERT(VARCHAR(20), @Condo)
IF @ListingType IS NOT NULL
SET @SQL = @SQL + ' AND r.ListingType = ' + CONVERT(char, @ListingType)
IF @WindowAir IS NOT NULL
SET @SQL = @SQL + ' AND a.WindowAir = ' + CONVERT(VARCHAR(20), @WindowAir)
IF @CentralAC IS NOT NULL
SET @SQL = @SQL + ' AND a.CentralAir = ' + CONVERT(VARCHAR(20), @CentralAC)
IF @BalconyDeckPatio IS NOT NULL
SET @SQL = @SQL + ' AND a.BalconyDeckPatio = ' + CONVERT(VARCHAR(20), @BalconyDeckPatio)
IF @UseOfYard IS NOT NULL
SET @SQL = @SQL + ' AND a.UseOfYard = ' + CONVERT(VARCHAR(20), @UseOfYard)
IF @Dishwasher IS NOT NULL
SET @SQL = @SQL + ' AND a.Dishwasher = ' + CONVERT(VARCHAR(20), @Dishwasher)
IF @WasherDryer IS NOT NULL
SET @SQL = @SQL + ' AND a.WasherDryer = ' + CONVERT(VARCHAR(20), @WasherDryer)
IF @Fireplace IS NOT NULL
SET @SQL = @SQL + ' AND a.Fireplace = ' + CONVERT(VARCHAR(20), @Fireplace)
IF @EIK IS NOT NULL
SET @SQL = @SQL + ' AND a.EIK = ' + CONVERT(VARCHAR(20), @EIK)
IF @HardwoodFloors IS NOT NULL
SET @SQL = @SQL + ' AND a.HardwoodFloors = ' + CONVERT(VARCHAR(20), @HardwoodFloors)
IF @BroadBandNet IS NOT NULL
SET @SQL = @SQL + ' AND a.BroadbandNet = ' + CONVERT(VARCHAR(20), @BroadbandNet)
IF @TV IS NOT NULL
SET @SQL = @SQL + ' AND a.TV = ' + CONVERT(VARCHAR(20), @TV)
IF @Thermostat IS NOT NULL
SET @SQL = @SQL + ' AND a.Thermostat = ' + CONVERT(VARCHAR(20), @Thermostat)
IF @LandlordNotPresent IS NOT NULL
SET @SQL = @SQL + ' AND a.LandLordNotPresent = ' + CONVERT(VARCHAR(20), @LandLordNotPresent)
IF @Smoking IS NOT NULL
SET @SQL = @SQL + ' AND a.Smoking = ' + CONVERT(VARCHAR(20), @Smoking)
IF @NoPetsAllowed IS NOT NULL
SET @SQL = @SQL + ' AND a.NoPetsAllowed = ' + CONVERT(VARCHAR(20), @NoPetsAllowed)
IF @Cat IS NOT NULL
SET @SQL = @SQL + ' AND a.Cat = ' + CONVERT(VARCHAR(20), @Cat)
IF @MoreCats IS NOT NULL
SET @SQL = @SQL + ' AND a.MoreCats = ' + CONVERT(VARCHAR(20), @MoreCats)
IF @SmallDog IS NOT NULL
SET @SQL = @SQL + ' AND a.SmallDog = ' + CONVERT(VARCHAR(20), @SmallDog)
IF @LargeDogs IS NOT NULL
SET @SQL = @SQL + ' AND a.LargeDogs = ' + CONVERT(VARCHAR(20), @LargeDogs)
IF @Doorperson IS NOT NULL
SET @SQL = @SQL + ' AND a.Doorperson = ' + CONVERT(VARCHAR(20), @Doorperson)
IF @IngroundPool IS NOT NULL
SET @SQL = @SQL + ' AND a.IngroundPool = ' + CONVERT(VARCHAR(20), @IngroundPool)
IF @AboveGroundPool IS NOT NULL
SET @SQL = @SQL + ' AND a.AboveGroundPool = ' + CONVERT(VARCHAR(20), @AboveGroundPool)
IF @Elevator IS NOT NULL
SET @SQL = @SQL + ' AND a.Elevator = ' + CONVERT(VARCHAR(20), @Elevator)
IF @UseOfGarage IS NOT NULL
SET @SQL = @SQL + ' AND a.UseOfGarage = ' + CONVERT(VARCHAR(20), @UseOfGarage)
IF @LaundryFacilities IS NOT NULL
SET @SQL = @SQL + ' AND a.LaundryFacilities = ' + CONVERT(VARCHAR(20), @LaundryFacilities)
IF @HealthCenter IS NOT NULL
SET @SQL = @SQL + ' AND a.Health Center = ' + CONVERT(VARCHAR(20), @HealthCenter)
IF @StorageAreas IS NOT NULL
SET @SQL = @SQL + ' AND a.StorageAreas = ' + CONVERT(VARCHAR(20), @StorageAreas)
IF @WheelchairAccess IS NOT NULL
SET @SQL = @SQL + ' AND a.WheelchairAccess = ' + CONVERT(VARCHAR(20), @WheelchairAccess)
IF @BusinessCenters IS NOT NULL
SET @SQL = @SQL + ' AND a.BusinessCenters = ' + CONVERT(VARCHAR(20), @BusinessCenters)
IF @RentChargeMin IS NOT NULL AND @RentChargeMAX IS NOT NULL
SET @SQL = @SQL + ' AND a.RentCharge BETWEEN ' + CONVERT(VARCHAR(20), @RentChargeMin) + ' AND ' + CONVERT(VARCHAR(20), @RentChargeMax)
IF @RentChargeMin IS NOT NULL AND @RentChargeMAX IS NULL
SET @SQL = @SQL + ' AND a.RentCharge >= ' + CONVERT(VARCHAR(20), @RentChargeMin)
IF @RentChargeMAX IS NULL AND @RentChargeMAX IS NOT NULL
SET @SQL = @SQL + ' AND a.RentCharge <= ' + CONVERT(VARCHAR(20), @RentChargeMax)

IF @Debug = 1
PRINT @SQL

EXEC (@SQL) 

View 5 Replies View Related

Newbie Needs Real Help

Feb 14, 2001

Hi. I am trying to setup php4 to talk to MSSQL 7, but am having no luck. Both are on a Win2k server. I get the error below. Please can someone tell me what to do, or even a step by step guide to setting up php to connect to a MSSQL7 database. I originally created the database in access 2000 and now want to use MSSQL to use it. This is the error i get:

Warning: MS SQL message: Could not locate entry in sysdatabases for database 'customers'. No entry found with that name. Make sure that the name is entered correctly. (severity 16) in C:Websiteewsiteestdb.php on line 13

Warning: MS SQL: Unable to select database: customers in C:Websiteewsiteestdb.php on line 13
Database unavailable

View 2 Replies View Related

The REAL Problem

Oct 3, 2000

I was running a server with TempDB in RAM (please don't comment on why that's not a good idea). Well, everything was fine until one of our administrator install teh backup exec agent and restarted the server. Since then the server won't start giving an error the Tempdb coulld not be moved into ram. Well, I started the server using the -f parameter and reset the Tempdb in RAM setting to zero. Howeever, it still won't start and gives the same error about not being able to move Tempdb into RAM. Is my only option to rebuild the master database? This is just a backup server but I'd like to avoid the hassle of rebuilding master and reinitializing the databases.


--Buddy

View 4 Replies View Related

A Real SQL Mindblower

May 18, 2004

Hi,

I'm trying to work out how to extract the information that I need from a set of database tables and can't think of a way of doing it with SQL.

The database forms the basis for a diary/calendar system for part-time employees and has two tables:

- One is called 'Availability' and holds info on each available hour slot in the calendar. The table just has fields 'time' and 'date', where the time is an integer representing an hour and date is datetime. The calendar runs from 07.00 to 23.00 each day, so there could be 16 rows in 'Availability' for one day. If any part of a day is unavailable (i.e. the employee doesn't work then) there will be no corresponding rows in the table.

- The second table is 'Appointments', which holds details of appointments that the employee is booked for. The main fields are 'date', 'time' and 'duration' (integer for minutes). All appointments will cover a time span that is also covered by an available period, but they are not actually linked in any way.

I need an SQL query that will return all available time slots that start at least 60 minutes after any appointments have FINISHED and at least 120 minutes before any appointment STARTS.

Since there is no link between the 'Appointments' table and the 'Availability' table, I can't think of any way of doing this.

Any ideas?

View 8 Replies View Related

Real To Datetime - How To...?

Mar 5, 2007

Hi,I would like to convert real data type to datetime type. Example:I have a real data type which is: 23,613456 (23 hours and 0,613456). Iwould like to have it in hh:mm:ss format. How to do this? Can I useconvert/cas function?Thanks for helpRgdsMario

View 1 Replies View Related

Finding If A REAL Is LIKE '%[49]9'

Jul 20, 2005

Timings... sometimes there are almost too many ways to do the same thing.The only significant findings I see from all the below timings is:1) Integer math is generally fastest, naturally. Bigint math isn't muchslower, for integers that all fit within an integer.2) Converting float to varchar is relatively slow, and should be avoided ifpossible. Converting from integer to varchar or varchar to int is severaltimes faster.3) Most significantly, and less obvious, CASE expr WHEN .... recomputes exprfor each WHEN condition, unfortunately, and is the same speed (or perhapsslightly slower) as listing WHEN expr = value for each condition. Perhaps anindexed computed column (somehow materialized) would be advisable whenpossible to avoid repeated computations in CASE..WHEN expressions (if thathelps..).Note that if you divide by COUNT(*), most timings below are below onemicrosecond per row, so this all may not be very significant in mostapplications, unless you do frequent aggregations of some sort.COUNT(*) FROM [my_sf_table] = 477446 rowsThe result from each query = either 47527 or 47527.0Platform: Athlon 2000 XP w/512MB RAM, table seems to be cached in RAM, SQL2000, all queries run at least 3 times and minimum timings shown (msec).SRP is a REAL (4 bytes)Fastest ones are near the end.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 clause2023 select sum(case when srp like '%[49]9' then 1 else 0 end)from sf-- Floating point method of taking a modulus (lacking fmod/modf)2291 select sum(case round(srp - 100e*floor(srp*.01e),0)when 99 then 1 when 49 then 1 else 0 end)from sf-- Round to nearest 50 and compare with 491322 select sum(case round(srp-50e*floor(srp*.02e),0)when 49 then 1 else 0 end)from sf-- Divide by 49 by multiplying by (slightly larger than) 1e/49e811 select sum(floor((cast(srp as integer)%50)*2.04082E-2))from sf-- Integer approach without using CASE731 select sum(coalesce(nullif(sign(cast(srp asinteger)%50-48),-1),0))from sf-- My original integer approach651 select sum(case cast(srp as integer)%100when 99 then 1 when 49 then 1 else 0 end)from sf-- Modulus 50 integer approach without CASE481 select sum((cast(srp as integer)%50)/49)from sf-- Modulus 50 integer approach460 select sum(case cast(srp as integer)%50when 49 then 1 else 0 end)from sf-- bigint without CASE531 select sum((cast(srp as bigint)%50)/49)from sf-- bigint with CASE521 select sum(case cast(srp as bigint)%50when 49 then 1 else 0 end)from sf-- get SIGN to return -1 or 0, then add 1-- much better than the coalesce+nullif approach500 select sum(sign(cast(srp as integer)%50-49)+1)from sf-- SIGN with BIGINT551 select sum(sign(cast(srp as bigint)%50-49)+1)from sfBTW, I know srp should be int to begin with for this to be faster... Okay,so...select cast(srp as int) srp into sf from [my_real_sf_table]720 select sum(case when srp like '%[49]9' then 1 else 0 end) from sf339 select sum(1+sign(srp%50-49)) from sf310 select sum(srp%50/49) from sf300 select sum(case srp%50 when 49 then 1 else 0 end) from sfWhat if it were a char(7)?select cast(cast(srp as integer) as char(7)) srp into sf2 from[my_sf_table]801 select sum(case right(rtrim(srp),2) when '49' then 1when '99' then 1 else 0 end) from sf2717 select sum(case when srp like '%[49]9' then 1 else 0 end) from sf2405 select sum(srp%50/49) from sf2391 select sum(case srp%50 when 49 then 1 else 0 end) from sf2How about varchar(7)?drop table sf2select cast(cast(srp as integer) as varchar(7)) srp into sf2 from[my_sf_table]581 select sum(case right(srp,2) when '49' then 1when '99' then 1 else 0 end) from sf2569 select sum(case when srp like '%[49]9' then 1 else 0 end) from sf2LIKE is faster on VARCHAR than on CHAR columns...Apparently it has to effectively RTRIM the trailing spaces during the LIKEoperation.Is binary collation any faster?drop table sf2select cast(cast(srp as integer) as varchar(7))COLLATE Latin1_General_BIN srpinto sf2 from tbl_superfile561 select sum(case right(srp,2) when '49' then 1when '99' then 1 else 0 end) from sf2530 select sum(case when srp like '%[49]9' then 1 else 0 end) from sf2Binary collation comparisons are slightly faster, though it's not a bigdifference (with just two characters being compared).662 select sum(case convert(binary(2),right(srp,2))when 0x3439 then 1 when 0x3939 then 1 else 0 end) from sf2-----------5037 select right(srp,2) srp,count(*) from my_sf_tablegroup by right(srp,2)order by right(srp,2)920 select cast(srp as int)%100 srp,count(*) from my_sf_tablegroup by cast(srp as int)%100order by cast(srp as int)%100---On the one hand, premature optimization can be a waste of time and energy.On the other hand, understanding performance implications of variousoperations can help write more efficient systems.In any case, an indexed computed column or one updated on a trigger couldvirtually eliminate the need for any of these calculations to be performed,except upon insertion or update, so maybe my comparisons aren't verymeaningful for most applications, considering we're talking about less than3 microseconds per row here worst-case.But the results remind me, some recommend avoiding Identity when it's notnecessary. I find Identity(int,1,1) to be a nice, compact surrogate key thatis useful for quick comparisons, grouping, etc, and so on. Also, it seemsmost appropriate as the primary key to all lookup tables in a star schema inOLAP data warehousing. (?) Of course, in some situations, it's notappropriate, particularly when having a surrogate key violates dataintegrity by allowing duplicates that would not be allowed with a properprimary key constraint, or when the surrogate key is completely redundantwith (especially a short) single-column unique key value that would be abetter selection as the primary key. With multi-column primary keys, I thinkit's sometimes convenient to have a surrogate Identity if only for INclauses that reference that identity column (though EXISTS can usuallyreplace those, so maybe that's a weak excuse for an extra column.)

View 4 Replies View Related

How Does The Real SQL String Look Like?

Aug 22, 2007

Hello,

I define the sql-query:

SELECT myColumn FROM myPersonsTable WHERE myColumn=@FirstName

then I declare some SqlParameters like:

SqlParameter par=new SqlParameter();
par.ParameterName="@FirstName";
par.Value="John";
mySqlCommand.Parameters.Add(par);

Showing the mySqlCommand.CommandString it will look like:
(A) SELECT myColumn FROM myPersonsTable WHERE myColumn=@FirstName
Is this the real string that is send to the Database (among with some hidden string "John")?...

...or does the real string which is send to the Database look like:
(B) SELECT myColumn FROM myPersonsTable WHERE myColumn='John'
???

If so, where can I retrieve that last string (B)?
Or is (A) the way 'transact sql' operates?

Henk

View 3 Replies View Related

Sa Real Login Name

Nov 8, 2006

Greetings,

I have a SQL Server 2000 database using Integrated Security. Users are added directly to the database from their domain name. In the Login section of the Security node in Enterprise Manager they show up as DomainNameUserName. I have four users that have the System Administrator database role. When I use the user function to get their user name they show up as dbo. Is there a way to get their actual domain user name?

Thanks.

View 3 Replies View Related







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