-
T-SQL: Find the first and last date (+1) for each price change
I have a table of price and date like: Price Date 3.20000000 2018-01-14 3.20000000 2018-01-18 3.20000000 2018-01-19 4.00000000 2018-02-10 4.00000000 2018-02-11 4.00000000 2018-02-12 5.10000000 2018-02-16 3.20000000 2018-03-11 4.00000000 2018-03-15 I wish to get the first date for every time the...
Last updated: -
Count empty tables in SQL Server database
In SQL Server, would there be a way for me to count the tables with no rows? Can I use a T-SQL statement? Thank you very much.
Last updated: -
T-SQL script for list of SQL Server 2008 R2 databases and user privileges
Does anyone know if there's a T-SQL script that would list all of our SQL Server 2008 R2 databases and the roles / privileges for one specific user? Thank you very much.
Last updated: -
Remove last character in T-SQL string
Is it possible to remove the last character in a T-SQL string? So for example, I have this: STRING I want to have this: STRIN Thanks!
-
Move table into schema in SQL Server 2008
I'm currently using SQL Server 2008 and here's my issue - I'm trying to move my table into a specific schema using T-SQL. I can't figure out how to do it. Can someone help me?
Last updated: -
T-SQL command to make SQL Server sleep
Would anyone happen to know if there's a T-SQL command that would make SQL Server sleep for some time (particularly several hours)? We're working on a web service that we want to test - to see if asynchronous pattern is scalable. For that to happen, we have to call a SQL Server with a script /...
Last updated: -
Oracle 10g CONTINUE keyword for T-SQL stored procedure migration
I'm looking to migrate a T-SQL stored procedure to PL/SQL but I'm constantly running into one particular issue. I noticed that there isn't a CONTINUE keyword for Oracle 10g. Is there a workaround for this? My friend told me to just upgrade but I can't do that right now.
Last updated: -
Select reserved words in Oracle
How can I select reserved words in Oracle. For example: In T-SQL, I'm able to select a column that's called table by using Select [table] from tablename. But I can't figure out how to do it with Oracle. Thank you very much.
Last updated: -
T-SQL: Split numbers into a table
For T-SQL, I have to split 1,2,3,4,5,6,7,8,9,10 9 into a table (also comma delimited). How can I do that? Is there some sort of function that I can return each one in a row? Thank you so much.
Last updated: -
SQL Server 2008: Write SELECT query to CSV file
For SQL Server 2008, I'm writing a SELECT query results to a CSV file. Can I do this using T-SQL? And I don't have access to SSIS too (I know you can do it there). Someone told me to use BCP utility - would that work? Thank you in advance.
Last updated: -
How do insert many images (BLOB) into a SQL Server table
How do I insert several images (BLOB) in to a SQL Server table?
Last updated: -
Add SQL Server Agent jobs to Microsoft Excel spreadsheet
I have a list of SQL Server Agent jobs and I need to add them to my Excel spreadsheet. The problem is that I don't want to do this manually. Is there a T-SQL command that would create this list for me?
Last updated: -
How to write this code in T-SQL?
How do I code this T-SQL: Write a summary query that returns three columns named CustLastName, CustomerID, and DollarValueOfOrders. The dollar value of the orders is to be the sum of the dollar value of the orders associated with the customer with the lastname of ‘Spaller’ and firstname of...
-
The query which works only in one database at a time. How to make it run in databases at once (like a loop one database after the other) is there any query to that?
Last updated: -
Hi, I need to pass a parameter into a stored procedure which values are dynamic always. Executing a variable which having the Select statement. Following query working fine. BEGIN DECLARE @strQuery NVARCHAR(MAX) DECLARE @CountryId INT DECLARE @CityId INT SET @CountryId = 2 SET @CityId = ' AND...
Last updated: -
Stored procedures in master DB, SQL Server 2005
Does anyone know where I can get a list describing, in layman's terms, all the sp_usr... stored procedures in the Master database? New to all this and don't have the time or knowledge to decipher the TSQL behind it. Hope someone can help! Cheers!
Last updated: -
T-SQL stored procedure conversion to C# CLR assembly
I'm wondering why it is difficult to find an example (in literature or Internet) example of converting a T-SQL procedure which contains "out" variables into identical C# CLR stored procedure. Is there something which prohibits this conversion? If not, can someone provide or cite example? Real...
Last updated: -
I want to have a stored procedure run on a schedule that automatically creates a database output file as a result and saves it to a specific location on my network. Can someone please tell me how to do this?
Last updated: -
Convert Oracle code to Microsoft SQL code
I've been given an Oracle DB that has some triggers and "LOAD DATA" jobs. Is there a tool/utility to convert the triggers/loads from PL/SQL into T-SQL?
-
Help on Bulk insert and xp_cmdshell rename
Hi, I have a csv with only one field with multiple rows, when i am using bulk insert to insert into sql server table, all the rows are inserted in to single column instead of multiple rows. I don't have a delimiter. csv file: (First row is blank) apple bat cat doll when I used the below command:...
Last updated: