I am trying to dd a column, to a database with the program Microsoft SQL Server Management Studio. I already have a database, with a table, in that table i need to add another column.. but it keeps saying it cannot find type bool or boolean. my code : Any ideas ? side question, any idea how to alter an
Tag: sql-server
Can I fetch multiple different SQL statements in one times loop? in PHP
I have to query SQL-SERVER’s Query and MYSQL’s Query (That have the same result format but it’s difference database) , But I want to call them in one while loop in PHP, Can I do that? Ex. EDITED : I just have an solved answer. It’s work for me Idea from @Drew while(bContinue) this my c…
How do I query time data type with between 2 times varying over midnight
How do I query time data type with between 2 times varying over midnight. Here is what I have tried. declare @timeValue time SET @timeValue = ’23:30:00′ SELECT @timeValue,DATEADD(minute, -30, @timeValue),DATEADD(minute, +30, @timeValue) WHERE @timeValue BETWEEN DATEADD(minute, -30, @timeValue) AND…
SQL Server 2012 takes long time on simple alter to add NULL columns
I have a problem to alter table in SQL Server 2012, it takes a long time to add 04 columns being allowed NULL to large table with 340 columns and approximately 166M rows and 01 non-clustered index This problem happens only specific table after restoring. I’m waiting the execution for 10 hours but itR…
Is there a LastIndexOf in SQL Server?
I am trying to parse out a value from a string that involves getting the last index of a string. Currently, I am doing a horrible hack that involves reversing a string: To me this code is nearly unreadable. I just upgraded to SQL Server 2016 and I hoping there is a better way. Is there? Answer If you want
SqlCommand only returns one row
Trying to only return the first few number of rows because my database was too big, however when I was testing my SQL, I did a select * and was only returned the first row. What is wrong with my solution? Answer In your loop you constantly re-create the instance of the variable logs thus overwriting the previ…
SQL – Remove all HTML tags in a string
In my dataset, I have a field which stores text marked up with HTML. The general format is as follows: <html><head></head><body><p>My text.</p></body></html> I could attempt to solve the problem by doing the following: However, this is not a strict rule as some …
Error converting data type varchar to int error in stored procedure
My stored procedure is SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[Customer_Registrations] @type varchar(50) = null, @Customer_ID int = null, @Customer_Name …
SQL: SAP Hana if parameter is null, ignore where
I’m passing 3 parameters into my Hana Stored Procedure to use as WHERE clauses, and if the parameter is null, I want the procedure to behave as though that condition doesn’t exist. example: if one of the input parameters is deviceType. if deviceType is null, query should simply be I know I can ach…
Hide characters in email address using an SQL query
I have a very specific business requirement to hide certain characters within an email address when returned from SQL and I have hit the limit of my ability with SQL to achieve this. I was wondering if someone out there would be able to point me in the right direction. Essentially, my business is asking for t…