sql-server

SQL Server: How do I convert all varchar(max) columns to text type?

How do I convert all varchar(max) columns to text type? I know varchar(max) is recommended but I still want to use type text because CakePHP doesn't automagically convert varchar(max) to textarea (HTML form). How do I do it? Thanks in advance ...

Temporary tables in sql server?

hi, I have a doubt Why Should we use temporary table is there any special thing in temporary table and where should we use the temporary tables. Can you please explain me or any reference thank you. ...

How to remove empty lines in SSMS?

I have many .sql files with lots of empty lines e.g. WITH cteTotalSales (SalesPersonID, NetSales) AS ( SELECT SalesPersonID, ROUND(SUM(SubTotal), 2) FROM Sales.SalesOrderHeader WHERE SalesPersonID IS NOT NULL GROUP BY SalesPersonID ) SELECT sp.FirstName + ' ' + sp.LastName AS FullName, sp.City + ',...

Microsoft Small Business Licensing Kick Start

I seem to recall hearing at some point (I believe it was MIX09) that Microsoft has a licensing model of some sort where a business can consume licenses for up to two years, free of charge, until they reach a point where they are stable position and can pay their licensing at the end of two years. However, I can't find information regard...

What is the relationship between a SPID and a Connection in SQL server?

Can a SPID be used by two connections, while both connections are open? If a connection is returned to a connection pool, will it hold on to the SPID? ...

Firing trigger for bulk insert

ALTER TRIGGER [dbo].[TR_O_SALESMAN_INS] ON [dbo].[O_SALESMAN] AFTER INSERT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for trigger here DECLARE @SLSMAN_CD NVARCHAR(20) DECLARE @SLSMAN_NAME NVARCHAR(20) SELECT @SLSMAN_CD...

How do I search for the comma character within data stored in SQL Server?

I have some data that I needs to be searched for the comma character. example entry I need to locate in the field Citation in the Citations table: This is sometimes true, Textual Reference In the end, I'm looking to extract Textual Reference Selecting the column with the data: select Citation from Citations; ...

exec sp_executesql error 'Incorrect syntax near 1' when using datetime parameter

I have a Ssrs report which sends the following text to the database : EXEC ( 'DECLARE @TeamIds as TeamIdTableType ' + @Teams + ' EXEC rpt.DWTypeOfSicknessByCategoryReport @TeamIds , ' + @DateFrom + ', ' + @DateTo + ', ' + @InputRankGroups + ', ' + @SubCategories ) When I view this in profiler it interprets this as : exec sp_execute...

Permission error while trying to access Sql from a web method

I created a web service which has a few web methods which inturn performs inserts/updates/select from a Sql Server and return non-primitive types. To test the web methods I tried using the Open source tool .net web service studio When I test for the web methods, I get the following error - Request for the permission of type 'System.Da...

How to import csv files

How can I import CSV file data into SQL Server 2000 table? I need to insert data from CSV file to table twice a day. Table has more then 20 fields but I only need to insert value into 6 fields. ...

SQL tables using VARCHAR with UTF8 (with respect to multi byte character length)

Like in Oracle VARCHAR( 60 CHAR ) I would like to specify a varchar field with variable length depending on the inserted characters. for example: create table X (text varchar(3)) insert into X (text) VALUES ('äöü') Should be possible (with UTF8 as the default charset of the database). On DB2 I got this Error: DB2 SQL Error: SQLCODE...

Best way to migrate export/import from SQL Server to oracle

Hi guys! I'm faced with needing access for reporting to some data that lives in Oracle and other data that lives in a SQL Server 2000 database. For various reasons these live on different sides of a firewall. Now we're looking at doing an export/import from sql server to oracle and I'd like some advice on the best way to go about it......

How to create a "copy" of SQL Server transaction log file

I want a copy of SQL Server transaction log file for "raw" analysis. What is the safest way to get a copy of that file without shutting down the database and disturbing the existing log/backups/backup schedules and just about everything. FYI, Its a SQL Server 2000 database server and I can see the log file (its about 4GB in size) and I ...

Connect to SQL Server from batch script

Hi, I am supplying a batch script to create a DSN connection in the user computer before they start to use my application. I am using this in a .bat file. ODBCConf ConfigSysDSN "SQL Server" "DSN=CONNAME|SERVER=PCNAME\INSTANCENAME But I want to make sure they will be able to connect to the database, considering the fact that proper dr...

Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.

Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'. when i m trying to execute sp then it through this error. Could you please help it out. ...

How to return empty cells for repeated values and keep only the cells which are different ?

I have a query that selects some fields to display from a table SELECT Field1, Field2, Field3, Field4 FROM table1 I want instead of returning : To return: How could I modify my SQL statement to return the second figure ? Or at least how to change the gridview properties of .Net to do so (if this is possible) ? ...

How can I show SQL Server LOGS (2005)

Hello, I'm trying to track the error thrown by SQL Server 2005. The problem is SQL Server reports it in my native language so it's hard for me to google it. I think that the core issue would be avialable in English in SQL Server LOGS. I'm running SQL Server Management Studio Express, going to "Management" node, and then SQL Server Log...

Getting .NET schema for a stored procedure result

I have a couple of stored procedures in T-SQL where each stored procedure has a fixed schema for the result set. I need to map the result sets for each procedure to a POCO object and need the column name and type for each column in the result set. Is there a quick way of accessing the information? The best way I have found so far is ac...

ssms copy database

Hello, I have a local sql express server with DB A and remote server uXXX.mssql.domainname.com with DB B. using sql mangament studio 2008, I want to move copy DB A to DB B with all tables, data, dependencies and stored procedures. how to figure out this problem? I only had understood table and table data copying(using Tasks->Import D...

Stored Procedure in Entity Framework

Hi I had added the Stored procedure in my Entity framework and i also imported the functions in the edmx. Is it must to add all the three functions insert, update, and delete functions to a table. I had tried with insert alone and also with all, but why can't i get the name of the stored procedure in the connection string. Let me know...